Chilkat Online Tools

autoit / Support API / List All Ticket Audits

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.BasicAuth = True
$oHttp.Login = "login"
$oHttp.Password = "password"

$oQueryParams = ObjCreate("Chilkat_9_5_0.JsonObject")
$oQueryParams.UpdateString("limit","<integer>")

$oHttp.SetRequestHeader "Accept","application/json"

Local $oResp = $oHttp.QuickRequestParams("GET","https://example.zendesk.com/api/v2/ticket_audits",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Failed." & @CRLF)

    Exit
EndIf

; 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

Local $sAuthor_id
Local $sCreated_at
Local $sId
Local $sAute__
Local $sEx_ae
Local $sTicket_id
Local $sChannel
Local $iEt_c59
Local $sVeniam_689
Local $sElit_2ab
Local $sSint490
Local $iJ
Local $iCount_j
Local $sVoluptate_edf
Local $iDolor0
Local $bSedb2
Local $sNostrud_fd6
Local $sUllamcoe
Local $bAdipisicing_1

Local $sAfter_cursor = $oJResp.StringOf("after_cursor")
Local $sAfter_url = $oJResp.StringOf("after_url")
Local $sBefore_cursor = $oJResp.StringOf("before_cursor")
Local $sBefore_url = $oJResp.StringOf("before_url")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("audits")
While $i < $iCount_i
    $oJResp.I = $i
    $sAuthor_id = $oJResp.StringOf("audits[i].author_id")
    $sCreated_at = $oJResp.StringOf("audits[i].created_at")
    $sId = $oJResp.StringOf("audits[i].id")
    $sAute__ = $oJResp.StringOf("audits[i].metadata.aute__")
    $sEx_ae = $oJResp.StringOf("audits[i].metadata.ex_ae")
    $sTicket_id = $oJResp.StringOf("audits[i].ticket_id")
    $sChannel = $oJResp.StringOf("audits[i].via.channel")
    $iEt_c59 = $oJResp.IntOf("audits[i].via.source.et_c59")
    $sVeniam_689 = $oJResp.StringOf("audits[i].metadata.veniam_689")
    $sElit_2ab = $oJResp.StringOf("audits[i].metadata.elit_2ab")
    $sSint490 = $oJResp.StringOf("audits[i].via.source.sint490")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("audits[i].events")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sVoluptate_edf = $oJResp.StringOf("audits[i].events[j].voluptate_edf")
        $iDolor0 = $oJResp.IntOf("audits[i].events[j].dolor0")
        $bSedb2 = $oJResp.BoolOf("audits[i].events[j].sedb2")
        $sNostrud_fd6 = $oJResp.StringOf("audits[i].events[j].nostrud_fd6")
        $sUllamcoe = $oJResp.StringOf("audits[i].events[j].ullamcoe")
        $bAdipisicing_1 = $oJResp.BoolOf("audits[i].events[j].adipisicing_1")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend

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}"
    }
  ]
}