Chilkat Online Tools

PowerBuilder / Support API / Retrieve Supported Filter Definition Items

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_V_Type
string ls_AllType
string ls_ItemsType
string ls_GroupType
string ls_Default
string ls_OperatorsType
string ls_TitleType
string ls_TitleDefault
string ls_ValueType
string ls_ValueDefault
integer li_MaxItems
string ls_TargetType
integer li_Nullable
string ls_TargetDefault
string ls_ValuesType
string ls_ListType
integer li_ValueNullable
integer li_ListMaxItems
string ls_TypeType
string ls_TypeDefault
integer li_AllMaxItems
string ls_AnyType
string ls_GroupDefault
integer li_OperatorsMaxItems
integer li_TargetNullable
integer li_AnyMaxItems

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.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
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/slas/policies/definitions",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
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.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)

// {
//   "definitions": {
//     "type": "object",
//     "properties": {
//       "all": {
//         "type": "array",
//         "items": {
//           "type": "object",
//           "properties": {
//             "group": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "operators": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             },
//             "target": {
//               "type": "string",
//               "nullable": true,
//               "default": "<string>"
//             },
//             "title": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "value": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "values": {
//               "type": "object",
//               "properties": {
//                 "list": {
//                   "type": "array",
//                   "items": {
//                     "type": "object",
//                     "properties": {
//                       "title": {
//                         "type": "string",
//                         "default": "<string>"
//                       },
//                       "value": {
//                         "type": "string",
//                         "nullable": true,
//                         "default": "<string>"
//                       }
//                     }
//                   },
//                   "maxItems": 2
//                 },
//                 "type": {
//                   "type": "string",
//                   "default": "<string>"
//                 }
//               }
//             }
//           }
//         },
//         "maxItems": 2
//       },
//       "any": {
//         "type": "array",
//         "items": {
//           "type": "object",
//           "properties": {
//             "group": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "operators": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             },
//             "target": {
//               "type": "string",
//               "nullable": true,
//               "default": "<string>"
//             },
//             "title": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "value": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "values": {
//               "type": "object",
//               "properties": {
//                 "list": {
//                   "type": "array",
//                   "items": {
//                     "type": "object",
//                     "properties": {
//                       "title": {
//                         "type": "string",
//                         "default": "<string>"
//                       },
//                       "value": {
//                         "type": "string",
//                         "nullable": true,
//                         "default": "<string>"
//                       }
//                     }
//                   },
//                   "maxItems": 2
//                 },
//                 "type": {
//                   "type": "string",
//                   "default": "<string>"
//                 }
//               }
//             }
//           }
//         },
//         "maxItems": 2
//       }
//     }
//   }
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_V_Type = loo_JResp.StringOf("definitions.type")
ls_AllType = loo_JResp.StringOf("definitions.properties.all.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.all.items.type")
ls_GroupType = loo_JResp.StringOf("definitions.properties.all.items.properties.group.type")
ls_Default = loo_JResp.StringOf("definitions.properties.all.items.properties.group.default")
ls_OperatorsType = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.items.type")
ls_TitleType = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.operators.items.properties.value.default")
li_MaxItems = loo_JResp.IntOf("definitions.properties.all.items.properties.operators.maxItems")
ls_TargetType = loo_JResp.StringOf("definitions.properties.all.items.properties.target.type")
li_Nullable = loo_JResp.BoolOf("definitions.properties.all.items.properties.target.nullable")
ls_TargetDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.target.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.all.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.all.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.value.default")
ls_ValuesType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.type")
ls_ListType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.items.type")
ls_TitleType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.items.properties.value.type")
li_ValueNullable = loo_JResp.BoolOf("definitions.properties.all.items.properties.values.properties.list.items.properties.value.nullable")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.list.items.properties.value.default")
li_ListMaxItems = loo_JResp.IntOf("definitions.properties.all.items.properties.values.properties.list.maxItems")
ls_TypeType = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.type.type")
ls_TypeDefault = loo_JResp.StringOf("definitions.properties.all.items.properties.values.properties.type.default")
li_AllMaxItems = loo_JResp.IntOf("definitions.properties.all.maxItems")
ls_AnyType = loo_JResp.StringOf("definitions.properties.any.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.any.items.type")
ls_GroupType = loo_JResp.StringOf("definitions.properties.any.items.properties.group.type")
ls_GroupDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.group.default")
ls_OperatorsType = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.items.type")
ls_TitleType = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.operators.items.properties.value.default")
li_OperatorsMaxItems = loo_JResp.IntOf("definitions.properties.any.items.properties.operators.maxItems")
ls_TargetType = loo_JResp.StringOf("definitions.properties.any.items.properties.target.type")
li_TargetNullable = loo_JResp.BoolOf("definitions.properties.any.items.properties.target.nullable")
ls_TargetDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.target.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.any.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.any.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.value.default")
ls_ValuesType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.type")
ls_ListType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.items.type")
ls_TitleType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.items.properties.value.type")
li_ValueNullable = loo_JResp.BoolOf("definitions.properties.any.items.properties.values.properties.list.items.properties.value.nullable")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.list.items.properties.value.default")
li_ListMaxItems = loo_JResp.IntOf("definitions.properties.any.items.properties.values.properties.list.maxItems")
ls_TypeType = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.type.type")
ls_TypeDefault = loo_JResp.StringOf("definitions.properties.any.items.properties.values.properties.type.default")
li_AnyMaxItems = loo_JResp.IntOf("definitions.properties.any.maxItems")


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/slas/policies/definitions

Postman Collection Item JSON

{
  "name": "Retrieve Supported Filter Definition Items",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/slas/policies/definitions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "slas",
        "policies",
        "definitions"
      ]
    },
    "description": "#### Availability\n\n* Accounts on the Support Professional or Suite Growth plan or above\n\n#### Allowed For\n\n* Admins\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/slas/policies/definitions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "slas",
            "policies",
            "definitions"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"definitions\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"all\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"group\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"operators\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"title\": {\n                    \"type\": \"string\",\n                    \"default\": \"<string>\"\n                  },\n                  \"value\": {\n                    \"type\": \"string\",\n                    \"default\": \"<string>\"\n                  }\n                }\n              },\n              \"maxItems\": 2\n            },\n            \"target\": {\n              \"type\": \"string\",\n              \"nullable\": true,\n              \"default\": \"<string>\"\n            },\n            \"title\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"values\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"list\": {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"object\",\n                    \"properties\": {\n                      \"title\": {\n                        \"type\": \"string\",\n                        \"default\": \"<string>\"\n                      },\n                      \"value\": {\n                        \"type\": \"string\",\n                        \"nullable\": true,\n                        \"default\": \"<string>\"\n                      }\n                    }\n                  },\n                  \"maxItems\": 2\n                },\n                \"type\": {\n                  \"type\": \"string\",\n                  \"default\": \"<string>\"\n                }\n              }\n            }\n          }\n        },\n        \"maxItems\": 2\n      },\n      \"any\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"group\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"operators\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"title\": {\n                    \"type\": \"string\",\n                    \"default\": \"<string>\"\n                  },\n                  \"value\": {\n                    \"type\": \"string\",\n                    \"default\": \"<string>\"\n                  }\n                }\n              },\n              \"maxItems\": 2\n            },\n            \"target\": {\n              \"type\": \"string\",\n              \"nullable\": true,\n              \"default\": \"<string>\"\n            },\n            \"title\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"value\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"values\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"list\": {\n                  \"type\": \"array\",\n                  \"items\": {\n                    \"type\": \"object\",\n                    \"properties\": {\n                      \"title\": {\n                        \"type\": \"string\",\n                        \"default\": \"<string>\"\n                      },\n                      \"value\": {\n                        \"type\": \"string\",\n                        \"nullable\": true,\n                        \"default\": \"<string>\"\n                      }\n                    }\n                  },\n                  \"maxItems\": 2\n                },\n                \"type\": {\n                  \"type\": \"string\",\n                  \"default\": \"<string>\"\n                }\n              }\n            }\n          }\n        },\n        \"maxItems\": 2\n      }\n    }\n  }\n}"
    }
  ]
}