PowerBuilder / Anypoint Platform APIs / Get csv formatted audit logs
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_JsonParam4
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
// Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_Req.AddParam("startDate","2021-04-20T12:24:36.971Z")
loo_Req.AddParam("endDate","2021-04-21T12:24:36.971Z")
loo_Req.AddParam("ascending","false")
loo_JsonParam4 = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JsonParam4.ConnectToNewObject("Chilkat.JsonObject")
loo_Req.AddParam("accessToken",loo_JsonParam4.Emit())
loo_Req.AddHeader("Authorization","Bearer {{token}}")
loo_Resp = loo_Http.PostUrlEncoded("https://domain.com/audit/v2/organizations/{{organization_id}}/query.csv",loo_Req)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
destroy loo_JsonParam4
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Req
destroy loo_JsonParam4
Curl Command
curl -X POST
-H "Authorization: Bearer {{token}}"
--data-urlencode 'startDate=2021-04-20T12:24:36.971Z'
--data-urlencode 'endDate=2021-04-21T12:24:36.971Z'
--data-urlencode 'ascending=false'
--data-urlencode 'accessToken={{token}}'
https://domain.com/audit/v2/organizations/{{organization_id}}/query.csv
Postman Collection Item JSON
{
"name": "Get csv formatted audit logs",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "startDate",
"value": "2021-04-20T12:24:36.971Z",
"type": "text"
},
{
"key": "endDate",
"value": "2021-04-21T12:24:36.971Z",
"type": "text"
},
{
"key": "ascending",
"value": "false",
"type": "text"
},
{
"key": "accessToken",
"value": "{{token}}",
"type": "text"
}
]
},
"url": {
"raw": "{{url}}/audit/v2/organizations/{{organization_id}}/query.csv",
"host": [
"{{url}}"
],
"path": [
"audit",
"v2",
"organizations",
"{{organization_id}}",
"query.csv"
]
}
},
"response": [
]
}