Chilkat Online Tools

VBScript / Support API / Show Many Custom Object Records

Back to Collection Items

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

' 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")
set http = CreateObject("Chilkat.Http")

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

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set queryParams = CreateObject("Chilkat.JsonObject")
success = queryParams.UpdateString("ids","<string>")
success = queryParams.UpdateString("ids","<string>")

http.SetRequestHeader "Accept","application/json"

' resp is a Chilkat.HttpResponse
Set resp = http.QuickRequestParams("GET","https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/show_many",queryParams)
If (http.LastMethodSuccess = 0) Then
    outFile.WriteLine(http.LastErrorText)
    WScript.Quit
End If

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbResponseBody = CreateObject("Chilkat.StringBuilder")
success = resp.GetBodySb(sbResponseBody)

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set jResp = CreateObject("Chilkat.JsonObject")
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0

outFile.WriteLine("Response Body:")
outFile.WriteLine(jResp.Emit())

respStatusCode = resp.StatusCode
outFile.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
    outFile.WriteLine("Response Header:")
    outFile.WriteLine(resp.Header)
    outFile.WriteLine("Failed.")

    WScript.Quit
End If

' 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

count = jResp.StringOf("count")
next_page = jResp.StringOf("next_page")
previous_page = jResp.StringOf("previous_page")
i = 0
count_i = jResp.SizeOfArray("custom_object_records")
Do While i < count_i
    jResp.I = i
    name = jResp.StringOf("custom_object_records[i].name")
    created_at = jResp.StringOf("custom_object_records[i].created_at")
    created_by_user_id = jResp.StringOf("custom_object_records[i].created_by_user_id")
    Voluptate571 = jResp.StringOf("custom_object_records[i].custom_object_fields.voluptate571")
    Aute_e = jResp.StringOf("custom_object_records[i].custom_object_fields.aute_e")
    Nostrud_6f = jResp.StringOf("custom_object_records[i].custom_object_fields.nostrud_6f")
    custom_object_key = jResp.StringOf("custom_object_records[i].custom_object_key")
    external_id = jResp.StringOf("custom_object_records[i].external_id")
    id = jResp.StringOf("custom_object_records[i].id")
    updated_at = jResp.StringOf("custom_object_records[i].updated_at")
    updated_by_user_id = jResp.StringOf("custom_object_records[i].updated_by_user_id")
    url = jResp.StringOf("custom_object_records[i].url")
    Eu4 = jResp.StringOf("custom_object_records[i].custom_object_fields.eu4")
    i = i + 1
Loop

outFile.Close

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