Chilkat Online Tools

PowerBuilder / Support API / List Trigger Action and Condition Definitions

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_ActionsType
string ls_ItemsType
string ls_GroupType
string ls_Default
string ls_NullableType
string ls_NullableDefault
string ls_RepeatableType
string ls_RepeatableDefault
string ls_SubjectType
string ls_SubjectDefault
string ls_TitleType
string ls_TitleDefault
string ls_TypeType
string ls_TypeDefault
string ls_ValuesType
string ls_EnabledType
string ls_EnabledDefault
string ls_ValueType
string ls_ValueDefault
integer li_MaxItems
integer li_ActionsMaxItems
string ls_Conditions_allType
string ls_GroupDefault
string ls_OperatorsType
string ls_TerminalType
string ls_TerminalDefault
integer li_OperatorsMaxItems
integer li_ValuesMaxItems
integer li_Conditions_allMaxItems
string ls_Conditions_anyType
integer li_Conditions_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/triggers/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": {
//       "actions": {
//         "type": "array",
//         "items": {
//           "type": "object",
//           "properties": {
//             "group": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "nullable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "repeatable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "subject": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "title": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "type": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "values": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "enabled": {
//                     "type": "boolean",
//                     "default": "<boolean>"
//                   },
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             }
//           }
//         },
//         "maxItems": 2
//       },
//       "conditions_all": {
//         "type": "array",
//         "items": {
//           "type": "object",
//           "properties": {
//             "group": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "nullable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "operators": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "terminal": {
//                     "type": "boolean",
//                     "default": "<boolean>"
//                   },
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             },
//             "repeatable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "subject": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "title": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "type": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "values": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "enabled": {
//                     "type": "boolean",
//                     "default": "<boolean>"
//                   },
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             }
//           }
//         },
//         "maxItems": 2
//       },
//       "conditions_any": {
//         "type": "array",
//         "items": {
//           "type": "object",
//           "properties": {
//             "group": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "nullable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "operators": {
//               "type": "array",
//               "items": {
//                 "type": "object",
//                 "properties": {
//                   "terminal": {
//                     "type": "boolean",
//                     "default": "<boolean>"
//                   },
//                   "title": {
//                     "type": "string",
//                     "default": "<string>"
//                   },
//                   "value": {
//                     "type": "string",
//                     "default": "<string>"
//                   }
//                 }
//               },
//               "maxItems": 2
//             },
//             "repeatable": {
//               "type": "boolean",
//               "default": "<boolean>"
//             },
//             "subject": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "title": {
//               "type": "string",
//               "default": "<string>"
//             },
//             "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_ActionsType = loo_JResp.StringOf("definitions.properties.actions.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.actions.items.type")
ls_GroupType = loo_JResp.StringOf("definitions.properties.actions.items.properties.group.type")
ls_Default = loo_JResp.StringOf("definitions.properties.actions.items.properties.group.default")
ls_NullableType = loo_JResp.StringOf("definitions.properties.actions.items.properties.nullable.type")
ls_NullableDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.nullable.default")
ls_RepeatableType = loo_JResp.StringOf("definitions.properties.actions.items.properties.repeatable.type")
ls_RepeatableDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.repeatable.default")
ls_SubjectType = loo_JResp.StringOf("definitions.properties.actions.items.properties.subject.type")
ls_SubjectDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.subject.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.actions.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.title.default")
ls_TypeType = loo_JResp.StringOf("definitions.properties.actions.items.properties.type.type")
ls_TypeDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.type.default")
ls_ValuesType = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.type")
ls_EnabledType = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.enabled.type")
ls_EnabledDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.enabled.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.actions.items.properties.values.items.properties.value.default")
li_MaxItems = loo_JResp.IntOf("definitions.properties.actions.items.properties.values.maxItems")
li_ActionsMaxItems = loo_JResp.IntOf("definitions.properties.actions.maxItems")
ls_Conditions_allType = loo_JResp.StringOf("definitions.properties.conditions_all.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.conditions_all.items.type")
ls_GroupType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.group.type")
ls_GroupDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.group.default")
ls_NullableType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.nullable.type")
ls_NullableDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.nullable.default")
ls_OperatorsType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.type")
ls_TerminalType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.terminal.type")
ls_TerminalDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.terminal.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.operators.items.properties.value.default")
li_OperatorsMaxItems = loo_JResp.IntOf("definitions.properties.conditions_all.items.properties.operators.maxItems")
ls_RepeatableType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.repeatable.type")
ls_RepeatableDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.repeatable.default")
ls_SubjectType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.subject.type")
ls_SubjectDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.subject.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.title.default")
ls_TypeType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.type.type")
ls_TypeDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.type.default")
ls_ValuesType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.type")
ls_EnabledType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.enabled.type")
ls_EnabledDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.enabled.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.conditions_all.items.properties.values.items.properties.value.default")
li_ValuesMaxItems = loo_JResp.IntOf("definitions.properties.conditions_all.items.properties.values.maxItems")
li_Conditions_allMaxItems = loo_JResp.IntOf("definitions.properties.conditions_all.maxItems")
ls_Conditions_anyType = loo_JResp.StringOf("definitions.properties.conditions_any.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.conditions_any.items.type")
ls_GroupType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.group.type")
ls_GroupDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.group.default")
ls_NullableType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.nullable.type")
ls_NullableDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.nullable.default")
ls_OperatorsType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.type")
ls_ItemsType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.type")
ls_TerminalType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.terminal.type")
ls_TerminalDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.terminal.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.title.default")
ls_ValueType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.value.type")
ls_ValueDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.operators.items.properties.value.default")
li_OperatorsMaxItems = loo_JResp.IntOf("definitions.properties.conditions_any.items.properties.operators.maxItems")
ls_RepeatableType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.repeatable.type")
ls_RepeatableDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.repeatable.default")
ls_SubjectType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.subject.type")
ls_SubjectDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.subject.default")
ls_TitleType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.title.type")
ls_TitleDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.title.default")
ls_TypeType = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.type.type")
ls_TypeDefault = loo_JResp.StringOf("definitions.properties.conditions_any.items.properties.type.default")
li_Conditions_anyMaxItems = loo_JResp.IntOf("definitions.properties.conditions_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/triggers/definitions

Postman Collection Item JSON

{
  "name": "List Trigger Action and Condition Definitions",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/triggers/definitions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "triggers",
        "definitions"
      ]
    },
    "description": "Returns the definitions of the actions a trigger can perform and the\ndefinitions of the conditions under which a trigger can execute. The\ndefinition of the action includes a title (\"Status\"), a type (\"list\"), and\npossible values. The definition of the condition includes the same fields\nas well as the possible operators.\n\nFor a list of supported actions, see the [Actions reference](/documentation/ticketing/reference-guides/actions-reference)\nFor a list of supported conditions, see the [Conditions reference](/documentation/ticketing/reference-guides/conditions-reference)\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/triggers/definitions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "triggers",
            "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      \"actions\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"group\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"nullable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"repeatable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"subject\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"title\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"values\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"enabled\": {\n                    \"type\": \"boolean\",\n                    \"default\": \"<boolean>\"\n                  },\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          }\n        },\n        \"maxItems\": 2\n      },\n      \"conditions_all\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"group\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"nullable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"operators\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"terminal\": {\n                    \"type\": \"boolean\",\n                    \"default\": \"<boolean>\"\n                  },\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            \"repeatable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"subject\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"title\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"values\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"enabled\": {\n                    \"type\": \"boolean\",\n                    \"default\": \"<boolean>\"\n                  },\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          }\n        },\n        \"maxItems\": 2\n      },\n      \"conditions_any\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"group\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"nullable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"operators\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"object\",\n                \"properties\": {\n                  \"terminal\": {\n                    \"type\": \"boolean\",\n                    \"default\": \"<boolean>\"\n                  },\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            \"repeatable\": {\n              \"type\": \"boolean\",\n              \"default\": \"<boolean>\"\n            },\n            \"subject\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"title\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            },\n            \"type\": {\n              \"type\": \"string\",\n              \"default\": \"<string>\"\n            }\n          }\n        },\n        \"maxItems\": 2\n      }\n    }\n  }\n}"
    }
  ]
}