Chilkat Online Tools

autoit / Support API / Show Many Custom Object Records

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("ids","<string>")
$oQueryParams.UpdateString("ids","<string>")

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

Local $oResp = $oHttp.QuickRequestParams("GET","https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/show_many",$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)

; {
;   "count": "<integer>",
;   "custom_object_records": [
;     {
;       "name": "<string>",
;       "created_at": "<dateTime>",
;       "created_by_user_id": "<string>",
;       "custom_object_fields": {
;         "voluptate571": "<string>",
;         "aute_e": "<string>",
;         "nostrud_6f": "<string>"
;       },
;       "custom_object_key": "<string>",
;       "external_id": "<string>",
;       "id": "<string>",
;       "updated_at": "<dateTime>",
;       "updated_by_user_id": "<string>",
;       "url": "<string>"
;     },
;     {
;       "name": "<string>",
;       "created_at": "<dateTime>",
;       "created_by_user_id": "<string>",
;       "custom_object_fields": {
;         "eu4": "<string>"
;       },
;       "custom_object_key": "<string>",
;       "external_id": "<string>",
;       "id": "<string>",
;       "updated_at": "<dateTime>",
;       "updated_by_user_id": "<string>",
;       "url": "<string>"
;     }
;   ],
;   "next_page": "<string>",
;   "previous_page": "<string>"
; }

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

Local $sName
Local $sCreated_at
Local $sCreated_by_user_id
Local $sVoluptate571
Local $sAute_e
Local $sNostrud_6f
Local $sCustom_object_key
Local $sExternal_id
Local $sId
Local $sUpdated_at
Local $sUpdated_by_user_id
Local $sUrl
Local $sEu4

Local $sCount = $oJResp.StringOf("count")
Local $sNext_page = $oJResp.StringOf("next_page")
Local $sPrevious_page = $oJResp.StringOf("previous_page")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("custom_object_records")
While $i < $iCount_i
    $oJResp.I = $i
    $sName = $oJResp.StringOf("custom_object_records[i].name")
    $sCreated_at = $oJResp.StringOf("custom_object_records[i].created_at")
    $sCreated_by_user_id = $oJResp.StringOf("custom_object_records[i].created_by_user_id")
    $sVoluptate571 = $oJResp.StringOf("custom_object_records[i].custom_object_fields.voluptate571")
    $sAute_e = $oJResp.StringOf("custom_object_records[i].custom_object_fields.aute_e")
    $sNostrud_6f = $oJResp.StringOf("custom_object_records[i].custom_object_fields.nostrud_6f")
    $sCustom_object_key = $oJResp.StringOf("custom_object_records[i].custom_object_key")
    $sExternal_id = $oJResp.StringOf("custom_object_records[i].external_id")
    $sId = $oJResp.StringOf("custom_object_records[i].id")
    $sUpdated_at = $oJResp.StringOf("custom_object_records[i].updated_at")
    $sUpdated_by_user_id = $oJResp.StringOf("custom_object_records[i].updated_by_user_id")
    $sUrl = $oJResp.StringOf("custom_object_records[i].url")
    $sEu4 = $oJResp.StringOf("custom_object_records[i].custom_object_fields.eu4")
    $i = $i + 1
Wend

Curl Command

curl  -u login:password -G -d "ids=%3Cstring%3E"
	-d "ids=%3Cstring%3E"
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/show_many

Postman Collection Item JSON

{
  "name": "Show Many Custom Object Records",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/custom_objects/:custom_object_key/records/show_many?ids=<string>&ids=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "custom_objects",
        ":custom_object_key",
        "records",
        "show_many"
      ],
      "query": [
        {
          "key": "ids",
          "value": "<string>",
          "description": "(Required) Array of ids to retieve"
        },
        {
          "key": "ids",
          "value": "<string>",
          "description": "(Required) Array of ids to retieve"
        }
      ],
      "variable": [
        {
          "key": "custom_object_key",
          "value": "<string>"
        }
      ]
    },
    "description": "List multiple custom object records by their ids\n#### Allowed For\n* Everyone"
  },
  "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/custom_objects/:custom_object_key/records/show_many?ids=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "custom_objects",
            ":custom_object_key",
            "records",
            "show_many"
          ],
          "query": [
            {
              "key": "ids",
              "value": "<string>",
              "description": "(Required) Array of ids to retieve"
            }
          ],
          "variable": [
            {
              "key": "custom_object_key"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"count\": \"<integer>\",\n  \"custom_object_records\": [\n    {\n      \"name\": \"<string>\",\n      \"created_at\": \"<dateTime>\",\n      \"created_by_user_id\": \"<string>\",\n      \"custom_object_fields\": {\n        \"voluptate571\": \"<string>\",\n        \"aute_e\": \"<string>\",\n        \"nostrud_6f\": \"<string>\"\n      },\n      \"custom_object_key\": \"<string>\",\n      \"external_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"updated_at\": \"<dateTime>\",\n      \"updated_by_user_id\": \"<string>\",\n      \"url\": \"<string>\"\n    },\n    {\n      \"name\": \"<string>\",\n      \"created_at\": \"<dateTime>\",\n      \"created_by_user_id\": \"<string>\",\n      \"custom_object_fields\": {\n        \"eu4\": \"<string>\"\n      },\n      \"custom_object_key\": \"<string>\",\n      \"external_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"updated_at\": \"<dateTime>\",\n      \"updated_by_user_id\": \"<string>\",\n      \"url\": \"<string>\"\n    }\n  ],\n  \"next_page\": \"<string>\",\n  \"previous_page\": \"<string>\"\n}"
    }
  ]
}