DataFlex / Support API / List Views - Compact
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sActive
String sAmet_b2
Boolean iPariatur_d74
Integer iEiusmodd7e
String sCreated_at
String sDefault
String sDescription
String sSit_bd1
Integer iVoluptated
String sId
String sPosition
String sOfficia_1c
String sTitle
String sUpdated_at
Integer iDo_99
Boolean iAliqua_ad
Integer iDolore277
String sLabore0
Integer iDeserunt00
String sVelit_90
String sDolor_58
String sSed_41
String sCount
String sNext_page
String sPrevious_page
Integer i
Integer iCount_i
String sTemp1
// 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"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://example.zendesk.com/api/v2/views/compact" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
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 ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// 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
Get ComStringOf Of hoJResp "count" To sCount
Get ComStringOf Of hoJResp "next_page" To sNext_page
Get ComStringOf Of hoJResp "previous_page" To sPrevious_page
Move 0 To i
Get ComSizeOfArray Of hoJResp "views" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "views[i].active" To sActive
Get ComStringOf Of hoJResp "views[i].conditions.amet_b2" To sAmet_b2
Get ComBoolOf Of hoJResp "views[i].conditions.pariatur_d74" To iPariatur_d74
Get ComIntOf Of hoJResp "views[i].conditions.eiusmodd7e" To iEiusmodd7e
Get ComStringOf Of hoJResp "views[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "views[i].default" To sDefault
Get ComStringOf Of hoJResp "views[i].description" To sDescription
Get ComStringOf Of hoJResp "views[i].execution.sit_bd1" To sSit_bd1
Get ComIntOf Of hoJResp "views[i].execution.voluptated" To iVoluptated
Get ComStringOf Of hoJResp "views[i].id" To sId
Get ComStringOf Of hoJResp "views[i].position" To sPosition
Get ComStringOf Of hoJResp "views[i].restriction.officia_1c" To sOfficia_1c
Get ComStringOf Of hoJResp "views[i].title" To sTitle
Get ComStringOf Of hoJResp "views[i].updated_at" To sUpdated_at
Get ComIntOf Of hoJResp "views[i].conditions.do_99" To iDo_99
Get ComBoolOf Of hoJResp "views[i].conditions.aliqua_ad" To iAliqua_ad
Get ComIntOf Of hoJResp "views[i].conditions.dolore277" To iDolore277
Get ComStringOf Of hoJResp "views[i].conditions.labore0" To sLabore0
Get ComIntOf Of hoJResp "views[i].execution.deserunt00" To iDeserunt00
Get ComStringOf Of hoJResp "views[i].execution.velit_90" To sVelit_90
Get ComStringOf Of hoJResp "views[i].restriction.dolor_58" To sDolor_58
Get ComStringOf Of hoJResp "views[i].restriction.sed_41" To sSed_41
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -u login:password -X GET
-H "Accept: application/json"
https://example.zendesk.com/api/v2/views/compact
Postman Collection Item JSON
{
"name": "List Views - Compact",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/views/compact",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views",
"compact"
]
},
"description": "A compacted list of shared and personal views available to the current user. This endpoint never returns more than 32 records and does not respect the \"per_page\" option.\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/compact",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views",
"compact"
]
}
},
"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}"
}
]
}