Foxpro / Support API / List Views - Compact
Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcActive
LOCAL lcAmet_b2
LOCAL lnPariatur_d74
LOCAL lnEiusmodd7e
LOCAL lcCreated_at
LOCAL lcDefault
LOCAL lcDescription
LOCAL lcSit_bd1
LOCAL lnVoluptated
LOCAL lcId
LOCAL lcPosition
LOCAL lcOfficia_1c
LOCAL lcTitle
LOCAL lcUpdated_at
LOCAL lnDo_99
LOCAL lnAliqua_ad
LOCAL lnDolore277
LOCAL lcLabore0
LOCAL lnDeserunt00
LOCAL lcVelit_90
LOCAL lcDolor_58
LOCAL lcSed_41
LOCAL lcCount
LOCAL lcNext_page
LOCAL lcPrevious_page
LOCAL i
LOCAL lnCount_i
* 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')
loHttp = CreateObject('Chilkat.Http')
loHttp.BasicAuth = 1
loHttp.Login = "login"
loHttp.Password = "password"
loHttp.SetRequestHeader("Accept","application/json")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://example.zendesk.com/api/v2/views/compact",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* 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
lcCount = loJResp.StringOf("count")
lcNext_page = loJResp.StringOf("next_page")
lcPrevious_page = loJResp.StringOf("previous_page")
i = 0
lnCount_i = loJResp.SizeOfArray("views")
DO WHILE i < lnCount_i
loJResp.I = i
lcActive = loJResp.StringOf("views[i].active")
lcAmet_b2 = loJResp.StringOf("views[i].conditions.amet_b2")
lnPariatur_d74 = loJResp.BoolOf("views[i].conditions.pariatur_d74")
lnEiusmodd7e = loJResp.IntOf("views[i].conditions.eiusmodd7e")
lcCreated_at = loJResp.StringOf("views[i].created_at")
lcDefault = loJResp.StringOf("views[i].default")
lcDescription = loJResp.StringOf("views[i].description")
lcSit_bd1 = loJResp.StringOf("views[i].execution.sit_bd1")
lnVoluptated = loJResp.IntOf("views[i].execution.voluptated")
lcId = loJResp.StringOf("views[i].id")
lcPosition = loJResp.StringOf("views[i].position")
lcOfficia_1c = loJResp.StringOf("views[i].restriction.officia_1c")
lcTitle = loJResp.StringOf("views[i].title")
lcUpdated_at = loJResp.StringOf("views[i].updated_at")
lnDo_99 = loJResp.IntOf("views[i].conditions.do_99")
lnAliqua_ad = loJResp.BoolOf("views[i].conditions.aliqua_ad")
lnDolore277 = loJResp.IntOf("views[i].conditions.dolore277")
lcLabore0 = loJResp.StringOf("views[i].conditions.labore0")
lnDeserunt00 = loJResp.IntOf("views[i].execution.deserunt00")
lcVelit_90 = loJResp.StringOf("views[i].execution.velit_90")
lcDolor_58 = loJResp.StringOf("views[i].restriction.dolor_58")
lcSed_41 = loJResp.StringOf("views[i].restriction.sed_41")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
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}"
}
]
}