From Bright Pattern Documentation
Jump to: navigation, search
• 5.19 • 5.3 • 5.8

Zendesk API Request

Zendesk API Request scenario block


The Zendesk API Request scenario block allows you to make a free-form Zendesk API request to Zendesk using JSON, making it possible to take a variety of actions with your integrated account. The block uses your preconfigured Zendesk integration account for authorization and so forth. Note that the HTTP method is configurable and the returned results are processed the same way as they are with the Fetch URL scenario block.


Zendesk API Request scenario block settings example


Settings

Title text

The name of the instance of the block.

Request type

The type of method to be used to retrieve content from the specified Zendesk URL.

Select from the following request types, or write in another method manually:

  • GET (default)
  • POST
  • PUT
  • PATCH
  • DELETE

URL

In this field, set requests.json in order to create an entity in Zendesk.

When this scenario block executes, it constructs a request to the Zendesk API. The block takes the integration account configuration URL https://<yourcompany>.zendesk.com and appends /api/v2/ and requests.json to it.

Extra Headers

Extra headers are the HTTP headers to add to the request (e.g., for authentication purposes). Headers are specified in name-value pairs, where name is the header name (e.g., "Authorization"), and value is the header value (e.g., "Bearer D18273561286FE9"). The value of the header can contain variables, and variables will be substituted with their value when the block is executed. By default, the list of extra headers is empty. For an example of using extra headers to make API requests on behalf of any end user, see the Zendesk Integration Guide, section Zendesk Scenario Examples.

To define a header, click add, type in the name, and type in the value.

Set fields

This setting is reserved.

Raw JSON

Where object properties are specified in JSON format.

Note: The code and the body of the received HTTP response will be stored in local variables $(integrationResultCode) and $(integrationResultBody), respectively. For troubleshooting purposes, use the EMail or Internal Message block to obtain the content of responses indicating a failed attempt to create an object. For more information, see the description of the variable $(integrationResultBody).

Initial path in the result JSON

If the response body contains JSON, this setting can be used to save into scenario variables a specific part of the data. Example: myobject.node.list[4]. The default is "none"; the path starts from the root of the returned JSON.

Scenario variable prefix for JSON data

This string will be used as the name of the variable to receive parsed JSON data. Note that if the initial path above points to an array, depending on the value of the following GetNext option, this variable would either contain the array or its first (and subsequent) elements.

Use GetNext block to loop through data

This box is selected if the JSON response data (at the initial path) is an array. The scenario variable will be set to the first element of the array and GetNext block could be used to iterate over the array elements, setting scenario variable to the next element.


Conditional Exits

Failed

The Failed conditional exit is taken if an error occurred during the API method execution.

No Data

The No Data conditional exit is executed if no data is returned in the body of the HTTP response.

< Previous | Next >