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 "access" "<string>"
CkJsonObject_UpdateString $queryParams "active" "<boolean>"
CkJsonObject_UpdateString $queryParams "group_id" "<integer>"
CkJsonObject_UpdateString $queryParams "sort_by" "<string>"
CkJsonObject_UpdateString $queryParams "sort_order" "<string>"
CkHttp_SetRequestHeader $http "Accept" "application/json"
# resp is a CkHttpResponse
set resp [CkHttp_QuickRequestParams $http "GET" "https://example.zendesk.com/api/v2/views" $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)
# {
# "count": "<integer>",
# "next_page": "<string>",
# "previous_page": "<string>",
# "views": [
# {
# "active": "<boolean>",
# "conditions": {
# "amet_b2": "minim et Ut aliquip",
# "pariatur_d74": true,
# "eiusmodd7e": 16274866
# },
# "created_at": "<dateTime>",
# "default": "<boolean>",
# "description": "<string>",
# "execution": {
# "sit_bd1": -70845421.92699432,
# "voluptated": -13477997
# },
# "id": "<integer>",
# "position": "<integer>",
# "restriction": {
# "officia_1c": -36345253.13616539
# },
# "title": "<string>",
# "updated_at": "<dateTime>"
# },
# {
# "active": "<boolean>",
# "conditions": {
# "do_99": 75108528,
# "aliqua_ad": true,
# "dolore277": 23927228,
# "labore0": "incididunt ut dolor"
# },
# "created_at": "<dateTime>",
# "default": "<boolean>",
# "description": "<string>",
# "execution": {
# "deserunt00": 61902530,
# "velit_90": "consectetur in Excepteur"
# },
# "id": "<integer>",
# "position": "<integer>",
# "restriction": {
# "dolor_58": -88642742.97884612,
# "sed_41": "commodo ut"
# },
# "title": "<string>",
# "updated_at": "<dateTime>"
# }
# ]
# }
# Sample code for parsing the JSON response...
# Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
set count [CkJsonObject_stringOf $jResp "count"]
set next_page [CkJsonObject_stringOf $jResp "next_page"]
set previous_page [CkJsonObject_stringOf $jResp "previous_page"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "views"]
while {$i < $count_i} {
CkJsonObject_put_I $jResp $i
set active [CkJsonObject_stringOf $jResp "views[i].active"]
set Amet_b2 [CkJsonObject_stringOf $jResp "views[i].conditions.amet_b2"]
set Pariatur_d74 [CkJsonObject_BoolOf $jResp "views[i].conditions.pariatur_d74"]
set Eiusmodd7e [CkJsonObject_IntOf $jResp "views[i].conditions.eiusmodd7e"]
set created_at [CkJsonObject_stringOf $jResp "views[i].created_at"]
set default [CkJsonObject_stringOf $jResp "views[i].default"]
set description [CkJsonObject_stringOf $jResp "views[i].description"]
set Sit_bd1 [CkJsonObject_stringOf $jResp "views[i].execution.sit_bd1"]
set Voluptated [CkJsonObject_IntOf $jResp "views[i].execution.voluptated"]
set id [CkJsonObject_stringOf $jResp "views[i].id"]
set position [CkJsonObject_stringOf $jResp "views[i].position"]
set Officia_1c [CkJsonObject_stringOf $jResp "views[i].restriction.officia_1c"]
set title [CkJsonObject_stringOf $jResp "views[i].title"]
set updated_at [CkJsonObject_stringOf $jResp "views[i].updated_at"]
set Do_99 [CkJsonObject_IntOf $jResp "views[i].conditions.do_99"]
set Aliqua_ad [CkJsonObject_BoolOf $jResp "views[i].conditions.aliqua_ad"]
set Dolore277 [CkJsonObject_IntOf $jResp "views[i].conditions.dolore277"]
set Labore0 [CkJsonObject_stringOf $jResp "views[i].conditions.labore0"]
set Deserunt00 [CkJsonObject_IntOf $jResp "views[i].execution.deserunt00"]
set Velit_90 [CkJsonObject_stringOf $jResp "views[i].execution.velit_90"]
set Dolor_58 [CkJsonObject_stringOf $jResp "views[i].restriction.dolor_58"]
set Sed_41 [CkJsonObject_stringOf $jResp "views[i].restriction.sed_41"]
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 "access=%3Cstring%3E"
-d "active=%3Cboolean%3E"
-d "group_id=%3Cinteger%3E"
-d "sort_by=%3Cstring%3E"
-d "sort_order=%3Cstring%3E"
-H "Accept: application/json"
https://example.zendesk.com/api/v2/views
Postman Collection Item JSON
{
"name": "List Views",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/views?access=<string>&active=<boolean>&group_id=<integer>&sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views"
],
"query": [
{
"key": "access",
"value": "<string>",
"description": "Only views with given access. May be \"personal\", \"shared\", or \"account\""
},
{
"key": "active",
"value": "<boolean>",
"description": "Only active views if true, inactive views if false"
},
{
"key": "group_id",
"value": "<integer>",
"description": "Only views belonging to given group"
},
{
"key": "sort_by",
"value": "<string>",
"description": "Possible values are \"alphabetical\", \"created_at\", or \"updated_at\". Defaults to \"position\""
},
{
"key": "sort_order",
"value": "<string>",
"description": "One of \"asc\" or \"desc\". Defaults to \"asc\" for alphabetical and position sort, \"desc\" for all others"
}
]
},
"description": "Lists shared and personal views available to the current user.\n\n#### Sideloads\n\nThe following sideloads are supported:\n\n| Name | Will sideload\n| ---------------- | -------------\n| app_installation | The app installation that requires each view, if present\n| permissions | The permissions for each view\n\n#### Pagination\n\n- Cursor pagination (recommended, but only sorts by `created_at`)\n- Offset pagination\n\nSee [Pagination](/api-reference/introduction/pagination/).\n\nReturns a maximum of 100 records per page.\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/views?access=<string>&active=<boolean>&group_id=<integer>&sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views"
],
"query": [
{
"key": "access",
"value": "<string>",
"description": "Only views with given access. May be \"personal\", \"shared\", or \"account\""
},
{
"key": "active",
"value": "<boolean>",
"description": "Only active views if true, inactive views if false"
},
{
"key": "group_id",
"value": "<integer>",
"description": "Only views belonging to given group"
},
{
"key": "sort_by",
"value": "<string>",
"description": "Possible values are \"alphabetical\", \"created_at\", or \"updated_at\". Defaults to \"position\""
},
{
"key": "sort_order",
"value": "<string>",
"description": "One of \"asc\" or \"desc\". Defaults to \"asc\" for alphabetical and position sort, \"desc\" for all others"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"count\": \"<integer>\",\n \"next_page\": \"<string>\",\n \"previous_page\": \"<string>\",\n \"views\": [\n {\n \"active\": \"<boolean>\",\n \"conditions\": {\n \"amet_b2\": \"minim et Ut aliquip\",\n \"pariatur_d74\": true,\n \"eiusmodd7e\": 16274866\n },\n \"created_at\": \"<dateTime>\",\n \"default\": \"<boolean>\",\n \"description\": \"<string>\",\n \"execution\": {\n \"sit_bd1\": -70845421.92699432,\n \"voluptated\": -13477997\n },\n \"id\": \"<integer>\",\n \"position\": \"<integer>\",\n \"restriction\": {\n \"officia_1c\": -36345253.13616539\n },\n \"title\": \"<string>\",\n \"updated_at\": \"<dateTime>\"\n },\n {\n \"active\": \"<boolean>\",\n \"conditions\": {\n \"do_99\": 75108528,\n \"aliqua_ad\": true,\n \"dolore277\": 23927228,\n \"labore0\": \"incididunt ut dolor\"\n },\n \"created_at\": \"<dateTime>\",\n \"default\": \"<boolean>\",\n \"description\": \"<string>\",\n \"execution\": {\n \"deserunt00\": 61902530,\n \"velit_90\": \"consectetur in Excepteur\"\n },\n \"id\": \"<integer>\",\n \"position\": \"<integer>\",\n \"restriction\": {\n \"dolor_58\": -88642742.97884612,\n \"sed_41\": \"commodo ut\"\n },\n \"title\": \"<string>\",\n \"updated_at\": \"<dateTime>\"\n }\n ]\n}"
}
]
}