Chilkat Online Tools

DataFlex / Support API / Retrieve Supported Filter Definition Items

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sV_Type
    String sAllType
    String sItemsType
    String sGroupType
    String sDefault
    String sOperatorsType
    String sTitleType
    String sTitleDefault
    String sValueType
    String sValueDefault
    Integer iMaxItems
    String sTargetType
    Boolean iNullable
    String sTargetDefault
    String sValuesType
    String sListType
    Boolean iValueNullable
    Integer iListMaxItems
    String sTypeType
    String sTypeDefault
    Integer iAllMaxItems
    String sAnyType
    String sGroupDefault
    Integer iOperatorsMaxItems
    Boolean iTargetNullable
    Integer iAnyMaxItems
    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/olas/policies/definitions" 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)

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

    Get ComStringOf Of hoJResp "definitions.type" To sV_Type
    Get ComStringOf Of hoJResp "definitions.properties.all.type" To sAllType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.group.type" To sGroupType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.group.default" To sDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.type" To sOperatorsType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.items.properties.value.type" To sValueType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.operators.items.properties.value.default" To sValueDefault
    Get ComIntOf Of hoJResp "definitions.properties.all.items.properties.operators.maxItems" To iMaxItems
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.target.type" To sTargetType
    Get ComBoolOf Of hoJResp "definitions.properties.all.items.properties.target.nullable" To iNullable
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.target.default" To sTargetDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.value.type" To sValueType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.value.default" To sValueDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.type" To sValuesType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.type" To sListType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.properties.value.type" To sValueType
    Get ComBoolOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.properties.value.nullable" To iValueNullable
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.items.properties.value.default" To sValueDefault
    Get ComIntOf Of hoJResp "definitions.properties.all.items.properties.values.properties.list.maxItems" To iListMaxItems
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.type.type" To sTypeType
    Get ComStringOf Of hoJResp "definitions.properties.all.items.properties.values.properties.type.default" To sTypeDefault
    Get ComIntOf Of hoJResp "definitions.properties.all.maxItems" To iAllMaxItems
    Get ComStringOf Of hoJResp "definitions.properties.any.type" To sAnyType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.group.type" To sGroupType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.group.default" To sGroupDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.type" To sOperatorsType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.items.properties.value.type" To sValueType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.operators.items.properties.value.default" To sValueDefault
    Get ComIntOf Of hoJResp "definitions.properties.any.items.properties.operators.maxItems" To iOperatorsMaxItems
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.target.type" To sTargetType
    Get ComBoolOf Of hoJResp "definitions.properties.any.items.properties.target.nullable" To iTargetNullable
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.target.default" To sTargetDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.value.type" To sValueType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.value.default" To sValueDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.type" To sValuesType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.type" To sListType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.type" To sItemsType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.properties.title.type" To sTitleType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.properties.title.default" To sTitleDefault
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.properties.value.type" To sValueType
    Get ComBoolOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.properties.value.nullable" To iValueNullable
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.items.properties.value.default" To sValueDefault
    Get ComIntOf Of hoJResp "definitions.properties.any.items.properties.values.properties.list.maxItems" To iListMaxItems
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.type.type" To sTypeType
    Get ComStringOf Of hoJResp "definitions.properties.any.items.properties.values.properties.type.default" To sTypeDefault
    Get ComIntOf Of hoJResp "definitions.properties.any.maxItems" To iAnyMaxItems


End_Procedure

Curl Command

curl  -u login:password -X GET
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/olas/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/olas/policies/definitions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "olas",
        "policies",
        "definitions"
      ]
    },
    "description": "#### 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/olas/policies/definitions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "olas",
            "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}"
    }
  ]
}