Chilkat Online Tools

DataFlex / Support API / List All Ticket Audits

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sAuthor_id
    String sCreated_at
    String sId
    String sAute__
    String sEx_ae
    String sTicket_id
    String sChannel
    Integer iEt_c59
    String sVeniam_689
    String sElit_2ab
    String sSint490
    Integer j
    Integer iCount_j
    String sVoluptate_edf
    Integer iDolor0
    Boolean iSedb2
    String sNostrud_fd6
    String sUllamcoe
    Boolean iAdipisicing_1
    String sAfter_cursor
    String sAfter_url
    String sBefore_cursor
    String sBefore_url
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Set ComBasicAuth Of hoHttp To True
    Set ComLogin Of hoHttp To "login"
    Set ComPassword Of hoHttp To "password"

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "limit" "<integer>" To iSuccess

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://example.zendesk.com/api/v2/ticket_audits" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

    // 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

    Get ComStringOf Of hoJResp "after_cursor" To sAfter_cursor
    Get ComStringOf Of hoJResp "after_url" To sAfter_url
    Get ComStringOf Of hoJResp "before_cursor" To sBefore_cursor
    Get ComStringOf Of hoJResp "before_url" To sBefore_url
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "audits" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "audits[i].author_id" To sAuthor_id
        Get ComStringOf Of hoJResp "audits[i].created_at" To sCreated_at
        Get ComStringOf Of hoJResp "audits[i].id" To sId
        Get ComStringOf Of hoJResp "audits[i].metadata.aute__" To sAute__
        Get ComStringOf Of hoJResp "audits[i].metadata.ex_ae" To sEx_ae
        Get ComStringOf Of hoJResp "audits[i].ticket_id" To sTicket_id
        Get ComStringOf Of hoJResp "audits[i].via.channel" To sChannel
        Get ComIntOf Of hoJResp "audits[i].via.source.et_c59" To iEt_c59
        Get ComStringOf Of hoJResp "audits[i].metadata.veniam_689" To sVeniam_689
        Get ComStringOf Of hoJResp "audits[i].metadata.elit_2ab" To sElit_2ab
        Get ComStringOf Of hoJResp "audits[i].via.source.sint490" To sSint490
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "audits[i].events" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "audits[i].events[j].voluptate_edf" To sVoluptate_edf
            Get ComIntOf Of hoJResp "audits[i].events[j].dolor0" To iDolor0
            Get ComBoolOf Of hoJResp "audits[i].events[j].sedb2" To iSedb2
            Get ComStringOf Of hoJResp "audits[i].events[j].nostrud_fd6" To sNostrud_fd6
            Get ComStringOf Of hoJResp "audits[i].events[j].ullamcoe" To sUllamcoe
            Get ComBoolOf Of hoJResp "audits[i].events[j].adipisicing_1" To iAdipisicing_1
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

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