API
API widgets are used to make API requests to read and write data using the GET or POST methods when the widget is triggered by an incoming call.
The API widget has two conditions:
Match — If the response value is valid then the flow will navigate to the Match condition. This is the ideal flow path.
No Match —If the response value is not valid, then the No Match condition will execute.
To use the API widget, perform the following steps:
- Drag the API widget onto the canvas from the Widget Library.
The API widget pop-up appears.
The API widget page has the following fields to configure:
- API Request
Request Type - Click the arrow next to the request type. The available options are GET and POST methods.
GET Method:
a. Enter the URL to be triggered using the GET method.
b. Give headers as per choice in a key/value pair. You can have multiple pairs.
POST Method:
a. Enter the URL to be triggered using the POST method.
b. Give headers as per choice in a key/value pair. You can have multiple pairs.
c. Click the arrow next to body type. The supported body types are JSON, XML, Text, and HTML. This is an Optional field.
-
Response Key
The Response key is used to match and validate the data configured in the response value, against the key.
Enter a specific response key to fetch or validate the data. -
Response Values
The Response value navigates the flow based on the success or failure of the API. The response value is matched against the response key configured. There are two types of response values. HTTP Status Match and Value Match.
Response Type - Click the arrow next to the response type. You can enter the response value either as an HTTP Status Match or Value Match. You can enter multiple values.
Value Match - This is a specific value that is matched against the response key.
HTTP Status Match - Here you need to provide a predefined HTTP code as a match. The response key is not required in this case.
Note:
Value Match supports only the JSON responses. The upper limit for response size is set to 10KB.
- Response Cache
The Response Cache is used to cache or store API responses for a specified period of time. If the same API is triggered multiple times within this time frame, the API response will be retrieved from the cache.
Enter the response cache in the text box.
Note:
Avoid repeated API calls when the response is similar, by caching for a certain time limit in minutes.
- Click Save to save the changes.
- Click Delete to delete the API widget.
Sample API Widget Flow Diagram:
Updated about 1 year ago