Back to Collection Items
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "startDate": "2021-04-20T12:05:21.714Z",
// "endDate": "2021-04-21T12:05:21.714Z",
// "platforms": [
// ],
// "objectTypes": [
// ],
// "environmentIds": [
// ],
// "actions": [
// ],
// "objectIds": [
// ],
// "userIds": [
// ],
// "ascending": false,
// "organizationId": "af696110-60f8-4a47-9367-e2464a468949",
// "offset": 0,
// "limit": 25
// }
CkJsonObject json = new CkJsonObject();
json.UpdateString("startDate","2021-04-20T12:05:21.714Z");
json.UpdateString("endDate","2021-04-21T12:05:21.714Z");
json.UpdateNewArray("platforms");
json.UpdateNewArray("objectTypes");
json.UpdateNewArray("environmentIds");
json.UpdateNewArray("actions");
json.UpdateNewArray("objectIds");
json.UpdateNewArray("userIds");
json.UpdateBool("ascending",false);
json.UpdateString("organizationId","af696110-60f8-4a47-9367-e2464a468949");
json.UpdateInt("offset",0);
json.UpdateInt("limit",25);
// Adds the "Authorization: Bearer {{token}}" header.
http.put_AuthToken("{{token}}");
CkHttpResponse resp = http.PostJson3("https://domain.com/audit/v2/organizations/{{organization_id}}/query?include_internal=false","application/json",json);
if (http.get_LastMethodSuccess() == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, String.valueOf(resp.get_StatusCode()));
Log.i(TAG, resp.bodyStr());
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
Curl Command
curl -X POST
-H "Authorization: Bearer {{token}}"
-d '{
"startDate":"2021-04-20T12:05:21.714Z",
"endDate":"2021-04-21T12:05:21.714Z",
"platforms":[
],
"objectTypes":[
],
"environmentIds":[
],
"actions":[
],
"objectIds":[
],
"userIds":[
],
"ascending":false,
"organizationId":"af696110-60f8-4a47-9367-e2464a468949",
"offset":0,
"limit":25
}'
https://domain.com/audit/v2/organizations/{{organization_id}}/query?include_internal=false
Postman Collection Item JSON
{
"name": "Get audit logs by filter",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"startDate\":\"2021-04-20T12:05:21.714Z\",\r\n \"endDate\":\"2021-04-21T12:05:21.714Z\",\r\n \"platforms\":[\r\n \r\n ],\r\n \"objectTypes\":[\r\n \r\n ],\r\n \"environmentIds\":[\r\n \r\n ],\r\n \"actions\":[\r\n \r\n ],\r\n \"objectIds\":[\r\n \r\n ],\r\n \"userIds\":[\r\n \r\n ],\r\n \"ascending\":false,\r\n \"organizationId\":\"af696110-60f8-4a47-9367-e2464a468949\",\r\n \"offset\":0,\r\n \"limit\":25\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/audit/v2/organizations/{{organization_id}}/query?include_internal=false",
"host": [
"{{url}}"
],
"path": [
"audit",
"v2",
"organizations",
"{{organization_id}}",
"query"
],
"query": [
{
"key": "include_internal",
"value": "false"
}
]
}
},
"response": [
]
}