Chilkat Online Tools

TCL / Support API / Show Many Job Statuses

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

CkHttp_put_BasicAuth $http 1
CkHttp_put_Login $http "login"
CkHttp_put_Password $http "password"

set queryParams [new_CkJsonObject]

CkJsonObject_UpdateString $queryParams "ids" "<string>"

CkHttp_SetRequestHeader $http "Accept" "application/json"

# resp is a CkHttpResponse
set resp [CkHttp_QuickRequestParams $http "GET" "https://example.zendesk.com/api/v2/job_statuses/show_many" $queryParams]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $queryParams
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkJsonObject $queryParams
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

delete_CkHttpResponse $resp

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# {
#   "job_statuses": [
#     {
#       "id": "<string>",
#       "message": "<string>",
#       "progress": "<integer>",
#       "results": [
#         {
#           "id": "<integer>",
#           "index": "<integer>"
#         },
#         {
#           "id": "<integer>",
#           "index": "<integer>"
#         }
#       ],
#       "status": "<string>",
#       "total": "<integer>",
#       "url": "<string>"
#     },
#     {
#       "id": "<string>",
#       "message": "<string>",
#       "progress": "<integer>",
#       "results": [
#         {
#           "id": "<integer>",
#           "index": "<integer>"
#         },
#         {
#           "id": "<integer>",
#           "index": "<integer>"
#         }
#       ],
#       "status": "<string>",
#       "total": "<integer>",
#       "url": "<string>"
#     }
#   ]
# }

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

set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "job_statuses"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set id [CkJsonObject_stringOf $jResp "job_statuses[i].id"]
    set message [CkJsonObject_stringOf $jResp "job_statuses[i].message"]
    set progress [CkJsonObject_stringOf $jResp "job_statuses[i].progress"]
    set status [CkJsonObject_stringOf $jResp "job_statuses[i].status"]
    set total [CkJsonObject_stringOf $jResp "job_statuses[i].total"]
    set url [CkJsonObject_stringOf $jResp "job_statuses[i].url"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "job_statuses[i].results"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set id [CkJsonObject_stringOf $jResp "job_statuses[i].results[j].id"]
        set index [CkJsonObject_stringOf $jResp "job_statuses[i].results[j].index"]
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

delete_CkHttp $http
delete_CkJsonObject $queryParams
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp

Curl Command

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

Postman Collection Item JSON

{
  "name": "Show Many Job Statuses",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/job_statuses/show_many?ids=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "job_statuses",
        "show_many"
      ],
      "query": [
        {
          "key": "ids",
          "value": "<string>",
          "description": "(Required) Comma-separated list of job status ids."
        }
      ]
    },
    "description": "Accepts a comma-separated list of job status ids.\n\n#### Allowed For:\n\n* Agents\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/job_statuses/show_many?ids=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "job_statuses",
            "show_many"
          ],
          "query": [
            {
              "key": "ids",
              "value": "<string>",
              "description": "(Required) Comma-separated list of job status ids."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"job_statuses\": [\n    {\n      \"id\": \"<string>\",\n      \"message\": \"<string>\",\n      \"progress\": \"<integer>\",\n      \"results\": [\n        {\n          \"id\": \"<integer>\",\n          \"index\": \"<integer>\"\n        },\n        {\n          \"id\": \"<integer>\",\n          \"index\": \"<integer>\"\n        }\n      ],\n      \"status\": \"<string>\",\n      \"total\": \"<integer>\",\n      \"url\": \"<string>\"\n    },\n    {\n      \"id\": \"<string>\",\n      \"message\": \"<string>\",\n      \"progress\": \"<integer>\",\n      \"results\": [\n        {\n          \"id\": \"<integer>\",\n          \"index\": \"<integer>\"\n        },\n        {\n          \"id\": \"<integer>\",\n          \"index\": \"<integer>\"\n        }\n      ],\n      \"status\": \"<string>\",\n      \"total\": \"<integer>\",\n      \"url\": \"<string>\"\n    }\n  ]\n}"
    }
  ]
}