Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'startDate', '<string>'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'endDate', '<string>'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'searchString', '<string>'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'format', 'csv'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://your-domain.atlassian.net/wiki/rest/api/audit/export', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAMethod @resp, 'SaveBodyBinary', @success OUT, 'response.zip'
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @resp, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed to save the response body to the filesystem.'
END
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
Curl Command
curl -G -d "startDate=%3Cstring%3E"
-d "endDate=%3Cstring%3E"
-d "searchString=%3Cstring%3E"
-d "format=csv"
-o "response.zip"
https://your-domain.atlassian.net/wiki/rest/api/audit/export
Postman Collection Item JSON
{
"name": "Export audit records",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/audit/export?startDate=<string>&endDate=<string>&searchString=<string>&format=csv",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"audit",
"export"
],
"query": [
{
"key": "startDate",
"value": "<string>",
"description": "Filters the exported results to the records on or after the `startDate`.\nThe `startDate` must be specified as a [timestamp](https://www.unixtimestamp.com/)."
},
{
"key": "endDate",
"value": "<string>",
"description": "Filters the exported results to the records on or before the `endDate`.\nThe `endDate` must be specified as a [timestamp](https://www.unixtimestamp.com/)."
},
{
"key": "searchString",
"value": "<string>",
"description": "Filters the exported results to records that have string property values\nmatching the `searchString`."
},
{
"key": "format",
"value": "csv",
"description": "The format of the export file for the audit records."
}
]
},
"description": "Exports audit records as a CSV file or ZIP file.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\n'Confluence Administrator' global permission."
},
"response": [
{
"name": "Returned if the requested export of the audit records is returned.",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/audit/export?startDate=<string>&endDate=<string>&searchString=<string>&format=csv",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"audit",
"export"
],
"query": [
{
"key": "startDate",
"value": "<string>"
},
{
"key": "endDate",
"value": "<string>"
},
{
"key": "searchString",
"value": "<string>"
},
{
"key": "format",
"value": "csv"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "application/zip"
}
],
"cookie": [
],
"body": "nostrud officia proident"
},
{
"name": "Returned if the calling user does not have permission to view the audit\nlog.",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/audit/export?startDate=<string>&endDate=<string>&searchString=<string>&format=csv",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"audit",
"export"
],
"query": [
{
"key": "startDate",
"value": "<string>"
},
{
"key": "endDate",
"value": "<string>"
},
{
"key": "searchString",
"value": "<string>"
},
{
"key": "format",
"value": "csv"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}