Chilkat Online Tools

Foxpro / Support API / List All Ticket Audits

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loQueryParams
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcAuthor_id
LOCAL lcCreated_at
LOCAL lcId
LOCAL lcAute__
LOCAL lcEx_ae
LOCAL lcTicket_id
LOCAL lcChannel
LOCAL lnEt_c59
LOCAL lcVeniam_689
LOCAL lcElit_2ab
LOCAL lcSint490
LOCAL j
LOCAL lnCount_j
LOCAL lcVoluptate_edf
LOCAL lnDolor0
LOCAL lnSedb2
LOCAL lcNostrud_fd6
LOCAL lcUllamcoe
LOCAL lnAdipisicing_1
LOCAL lcAfter_cursor
LOCAL lcAfter_url
LOCAL lcBefore_cursor
LOCAL lcBefore_url
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

loHttp.BasicAuth = 1
loHttp.Login = "login"
loHttp.Password = "password"

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loQueryParams = CreateObject('Chilkat.JsonObject')
loQueryParams.UpdateString("limit","<integer>")

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

loResp = loHttp.QuickRequestParams("GET","https://example.zendesk.com/api/v2/ticket_audits",loQueryParams)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loQueryParams
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loQueryParams
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

lcAfter_cursor = loJResp.StringOf("after_cursor")
lcAfter_url = loJResp.StringOf("after_url")
lcBefore_cursor = loJResp.StringOf("before_cursor")
lcBefore_url = loJResp.StringOf("before_url")
i = 0
lnCount_i = loJResp.SizeOfArray("audits")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcAuthor_id = loJResp.StringOf("audits[i].author_id")
    lcCreated_at = loJResp.StringOf("audits[i].created_at")
    lcId = loJResp.StringOf("audits[i].id")
    lcAute__ = loJResp.StringOf("audits[i].metadata.aute__")
    lcEx_ae = loJResp.StringOf("audits[i].metadata.ex_ae")
    lcTicket_id = loJResp.StringOf("audits[i].ticket_id")
    lcChannel = loJResp.StringOf("audits[i].via.channel")
    lnEt_c59 = loJResp.IntOf("audits[i].via.source.et_c59")
    lcVeniam_689 = loJResp.StringOf("audits[i].metadata.veniam_689")
    lcElit_2ab = loJResp.StringOf("audits[i].metadata.elit_2ab")
    lcSint490 = loJResp.StringOf("audits[i].via.source.sint490")
    j = 0
    lnCount_j = loJResp.SizeOfArray("audits[i].events")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcVoluptate_edf = loJResp.StringOf("audits[i].events[j].voluptate_edf")
        lnDolor0 = loJResp.IntOf("audits[i].events[j].dolor0")
        lnSedb2 = loJResp.BoolOf("audits[i].events[j].sedb2")
        lcNostrud_fd6 = loJResp.StringOf("audits[i].events[j].nostrud_fd6")
        lcUllamcoe = loJResp.StringOf("audits[i].events[j].ullamcoe")
        lnAdipisicing_1 = loJResp.BoolOf("audits[i].events[j].adipisicing_1")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loQueryParams
RELEASE loSbResponseBody
RELEASE loJResp

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