DataFlex / Support API / List Active Views
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
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
Boolean bTemp1
// 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"
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "access" "<string>" To iSuccess
Get ComUpdateString Of hoQueryParams "group_id" "<integer>" To iSuccess
Get ComUpdateString Of hoQueryParams "sort_by" "<string>" To iSuccess
Get ComUpdateString Of hoQueryParams "sort_order" "<string>" To iSuccess
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://example.zendesk.com/api/v2/views/active" vQueryParams To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
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 ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// 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 -G -d "access=%3Cstring%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/active
Postman Collection Item JSON
{
"name": "List Active Views",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/views/active?access=<string>&group_id=<integer>&sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views",
"active"
],
"query": [
{
"key": "access",
"value": "<string>",
"description": "Only views with given access. May be \"personal\", \"shared\", or \"account\""
},
{
"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 active 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- 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/active?access=<string>&group_id=<integer>&sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"views",
"active"
],
"query": [
{
"key": "access",
"value": "<string>",
"description": "Only views with given access. May be \"personal\", \"shared\", or \"account\""
},
{
"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}"
}
]
}