Chilkat Online Tools

PowerBuilder / Support API / List All Ticket Audits

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Author_id
string ls_Created_at
string ls_Id
string ls_Aute__
string ls_Ex_ae
string ls_Ticket_id
string ls_Channel
integer li_Et_c59
string ls_Veniam_689
string ls_Elit_2ab
string ls_Sint490
integer j
integer li_Count_j
string ls_Voluptate_edf
integer li_Dolor0
integer li_Sedb2
string ls_Nostrud_fd6
string ls_Ullamcoe
integer li_Adipisicing_1
string ls_After_cursor
string ls_After_url
string ls_Before_cursor
string ls_Before_url
integer i
integer li_Count_i

// 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_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"

loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")

loo_QueryParams.UpdateString("limit","<integer>")

loo_Http.SetRequestHeader("Accept","application/json")

loo_Resp = loo_Http.QuickRequestParams("GET","https://example.zendesk.com/api/v2/ticket_audits",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_QueryParams
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "after_cursor": "<string>",
//   "after_url": "<string>",
//   "audits": [
//     {
//       "author_id": "<integer>",
//       "created_at": "<dateTime>",
//       "events": [
//         {
//           "voluptate_edf": 37194901.82832828,
//           "dolor0": 61753613
//         },
//         {
//           "sedb2": false
//         }
//       ],
//       "id": "<integer>",
//       "metadata": {
//         "aute__": "proident aute qui culpa",
//         "ex_ae": "dolore Lorem labore ut"
//       },
//       "ticket_id": "<integer>",
//       "via": {
//         "channel": "<string>",
//         "source": {
//           "et_c59": 68912889
//         }
//       }
//     },
//     {
//       "author_id": "<integer>",
//       "created_at": "<dateTime>",
//       "events": [
//         {
//           "nostrud_fd6": -68241256.05178377
//         },
//         {
//           "ullamcoe": "ad",
//           "adipisicing_1": false
//         }
//       ],
//       "id": "<integer>",
//       "metadata": {
//         "veniam_689": -18333948.100650415,
//         "elit_2ab": "eu dolor deserunt consequat dolore"
//       },
//       "ticket_id": "<integer>",
//       "via": {
//         "channel": "<string>",
//         "source": {
//           "sint490": -68016605.99205834
//         }
//       }
//     }
//   ],
//   "before_cursor": "<string>",
//   "before_url": "<string>"
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_After_cursor = loo_JResp.StringOf("after_cursor")
ls_After_url = loo_JResp.StringOf("after_url")
ls_Before_cursor = loo_JResp.StringOf("before_cursor")
ls_Before_url = loo_JResp.StringOf("before_url")
i = 0
li_Count_i = loo_JResp.SizeOfArray("audits")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Author_id = loo_JResp.StringOf("audits[i].author_id")
    ls_Created_at = loo_JResp.StringOf("audits[i].created_at")
    ls_Id = loo_JResp.StringOf("audits[i].id")
    ls_Aute__ = loo_JResp.StringOf("audits[i].metadata.aute__")
    ls_Ex_ae = loo_JResp.StringOf("audits[i].metadata.ex_ae")
    ls_Ticket_id = loo_JResp.StringOf("audits[i].ticket_id")
    ls_Channel = loo_JResp.StringOf("audits[i].via.channel")
    li_Et_c59 = loo_JResp.IntOf("audits[i].via.source.et_c59")
    ls_Veniam_689 = loo_JResp.StringOf("audits[i].metadata.veniam_689")
    ls_Elit_2ab = loo_JResp.StringOf("audits[i].metadata.elit_2ab")
    ls_Sint490 = loo_JResp.StringOf("audits[i].via.source.sint490")
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("audits[i].events")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Voluptate_edf = loo_JResp.StringOf("audits[i].events[j].voluptate_edf")
        li_Dolor0 = loo_JResp.IntOf("audits[i].events[j].dolor0")
        li_Sedb2 = loo_JResp.BoolOf("audits[i].events[j].sedb2")
        ls_Nostrud_fd6 = loo_JResp.StringOf("audits[i].events[j].nostrud_fd6")
        ls_Ullamcoe = loo_JResp.StringOf("audits[i].events[j].ullamcoe")
        li_Adipisicing_1 = loo_JResp.BoolOf("audits[i].events[j].adipisicing_1")
        j = j + 1
    loop
    i = i + 1
loop


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl  -u login:password -G -d "limit=%3Cinteger%3E"
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/ticket_audits

Postman Collection Item JSON

{
  "name": "List All Ticket Audits",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/ticket_audits?limit=<integer>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "ticket_audits"
      ],
      "query": [
        {
          "key": "limit",
          "value": "<integer>",
          "description": "Maximum number of results returned"
        }
      ]
    },
    "description": "Returns ticket audits. Archived tickets are not included in the response. Use the [List Audits for a Ticket](#list-audits-for-a-ticket) endpoint to \nretrieve audit records for an archived ticket. To learn more about archived tickets, see [About archived tickets](https://support.zendesk.com/hc/en-us/articles/203657756).\n\nThis endpoint should not be used for capturing change data. When continually chasing the tail of a cursor, some records will be skipped. For this use case, use the [Incremental Ticket Event Export API](/api-reference/ticketing/ticket-management/incremental_exports/#incremental-ticket-event-export).\n\n#### Pagination\n\n- Cursor pagination\n\nSee [Pagination](/api-reference/introduction/pagination/).\n\nReturns a maximum of 100 records per page.\n\n#### Allowed For\n\n* Admins\n"
  },
  "response": [
    {
      "name": "Success response",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v2/ticket_audits?limit=<integer>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "ticket_audits"
          ],
          "query": [
            {
              "key": "limit",
              "value": "<integer>",
              "description": "Maximum number of results returned"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"after_cursor\": \"<string>\",\n  \"after_url\": \"<string>\",\n  \"audits\": [\n    {\n      \"author_id\": \"<integer>\",\n      \"created_at\": \"<dateTime>\",\n      \"events\": [\n        {\n          \"voluptate_edf\": 37194901.82832828,\n          \"dolor0\": 61753613\n        },\n        {\n          \"sedb2\": false\n        }\n      ],\n      \"id\": \"<integer>\",\n      \"metadata\": {\n        \"aute__\": \"proident aute qui culpa\",\n        \"ex_ae\": \"dolore Lorem labore ut\"\n      },\n      \"ticket_id\": \"<integer>\",\n      \"via\": {\n        \"channel\": \"<string>\",\n        \"source\": {\n          \"et_c59\": 68912889\n        }\n      }\n    },\n    {\n      \"author_id\": \"<integer>\",\n      \"created_at\": \"<dateTime>\",\n      \"events\": [\n        {\n          \"nostrud_fd6\": -68241256.05178377\n        },\n        {\n          \"ullamcoe\": \"ad\",\n          \"adipisicing_1\": false\n        }\n      ],\n      \"id\": \"<integer>\",\n      \"metadata\": {\n        \"veniam_689\": -18333948.100650415,\n        \"elit_2ab\": \"eu dolor deserunt consequat dolore\"\n      },\n      \"ticket_id\": \"<integer>\",\n      \"via\": {\n        \"channel\": \"<string>\",\n        \"source\": {\n          \"sint490\": -68016605.99205834\n        }\n      }\n    }\n  ],\n  \"before_cursor\": \"<string>\",\n  \"before_url\": \"<string>\"\n}"
    }
  ]
}