Chilkat Online Tools

PowerBuilder / Support API / List Views - Compact

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Active
string ls_Amet_b2
integer li_Pariatur_d74
integer li_Eiusmodd7e
string ls_Created_at
string ls_Default
string ls_Description
string ls_Sit_bd1
integer li_Voluptated
string ls_Id
string ls_Position
string ls_Officia_1c
string ls_Title
string ls_Updated_at
integer li_Do_99
integer li_Aliqua_ad
integer li_Dolore277
string ls_Labore0
integer li_Deserunt00
string ls_Velit_90
string ls_Dolor_58
string ls_Sed_41
string ls_Count
string ls_Next_page
string ls_Previous_page
integer i
integer li_Count_i

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

loo_Http.SetRequestHeader("Accept","application/json")

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/views/compact",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// 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

ls_Count = loo_JResp.StringOf("count")
ls_Next_page = loo_JResp.StringOf("next_page")
ls_Previous_page = loo_JResp.StringOf("previous_page")
i = 0
li_Count_i = loo_JResp.SizeOfArray("views")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Active = loo_JResp.StringOf("views[i].active")
    ls_Amet_b2 = loo_JResp.StringOf("views[i].conditions.amet_b2")
    li_Pariatur_d74 = loo_JResp.BoolOf("views[i].conditions.pariatur_d74")
    li_Eiusmodd7e = loo_JResp.IntOf("views[i].conditions.eiusmodd7e")
    ls_Created_at = loo_JResp.StringOf("views[i].created_at")
    ls_Default = loo_JResp.StringOf("views[i].default")
    ls_Description = loo_JResp.StringOf("views[i].description")
    ls_Sit_bd1 = loo_JResp.StringOf("views[i].execution.sit_bd1")
    li_Voluptated = loo_JResp.IntOf("views[i].execution.voluptated")
    ls_Id = loo_JResp.StringOf("views[i].id")
    ls_Position = loo_JResp.StringOf("views[i].position")
    ls_Officia_1c = loo_JResp.StringOf("views[i].restriction.officia_1c")
    ls_Title = loo_JResp.StringOf("views[i].title")
    ls_Updated_at = loo_JResp.StringOf("views[i].updated_at")
    li_Do_99 = loo_JResp.IntOf("views[i].conditions.do_99")
    li_Aliqua_ad = loo_JResp.BoolOf("views[i].conditions.aliqua_ad")
    li_Dolore277 = loo_JResp.IntOf("views[i].conditions.dolore277")
    ls_Labore0 = loo_JResp.StringOf("views[i].conditions.labore0")
    li_Deserunt00 = loo_JResp.IntOf("views[i].execution.deserunt00")
    ls_Velit_90 = loo_JResp.StringOf("views[i].execution.velit_90")
    ls_Dolor_58 = loo_JResp.StringOf("views[i].restriction.dolor_58")
    ls_Sed_41 = loo_JResp.StringOf("views[i].restriction.sed_41")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

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