If you want to provide other people with an API to your Triggre application, you can do so by creating an Incoming Web API.
Step 1: creating the Incoming Web API
-
Create an Automation flow with a Connection Triggre as the start:
-
Add any Properties you want as Inputs. Please note you can not use Data items, only Property types such as Text, Number and Date:
-
Complete your Automation flow and publish your application.
Step 2: locating your Web API
In order to call your new Web API, you first need to know the URL where it is available. The URL that Triggre generates uses the following template:
- https://{application}/{environment}/interfaces/rest/{automation flow name}/{automation_flow_name_with_underscores}
Let’s take a look at the following example:
- Application: example.triggre.net
- Environment: Lab
- Flow name: My first incoming Web API
This would mean that Triggre creates an incoming Web API for you on the following URL:
- Triggre - Application not available first incoming web api/my_first_incoming_web_api
Tip: The Automation flow part of the URLs is case-insensitive (after the /rest/ part), so whether you use capitalized words or not, doesn’t matter.
Step 3: calling your incoming Web API
To call your Web API, you will need to use a POST request with the data you want to supply as JSON. Make sure to set the Content-Type header of your request to Application/json.
Triggre uses Basic Authentication for incoming Web APIs, which means you will need to provide a Username and Password by sending them in a header:
- Authentication: Basic Base64Encode(“username:password”)
For more details on how Basic Authentication works, see this Wikipedia article. To find the Connection credentials to use, see our article Finding your connection credentials.
The data you send must be structured as a JSON object. For example, if our incoming Web API has only a single Input, a text named Example input then the data you send should look like this:
The incoming Web API will return a status code of 200 on success, and any data you have configured as Output as a JSON object as well.
Supported types
Triggre property | JSON type |
---|---|
Texts | |
Any text | string |
string | |
URL | string |
Numbers | |
Number (no decimals) | number or string* |
Number (1-6 decimals) | number or string* |
Dates & times | |
Date | string, formatted** as: YYYY-MM-DD DD-MM-YYYY DD/MM/YYYY DD.MM.YYYY |
Date & time | string, formatted** as: YYYY-MM-DDThh:mm:ssZ YYYY-MM-DDThh:mm:ss+hh:mm DD-MM-YYYY hh:mm:ss DD/MM/YYYY hh:mm:ss DD.MM.YYYY hh:mm:ss DD-MM-YYYY, hh:mm:ss DD/MM/YYYY, hh:mm:ss DD.MM.YYYY, hh:mm:ss |
Time of day | string, formatted** as: hh:mm |
Duration | string, formatted** as: hh:mm:ss |
Files | |
Any file | object with url*** property, e.g. { “Url”: “https://some.file”} |
Document | object with url*** property, e.g. { “Url”: “https://some.document”} |
Picture | object with url*** property, e.g. { “Url”: “https://some.image”} |
Other types | |
True/false | boolean |
Pick list | string, value must correspond to pick list value |
*) You can use a string for very large numbers, that are not natively supported. In most cases, just a number will be sufficient.
**) Date time notations used per the W3.org date time standard.
***) Note that the Url property is case sensitive and must start with a capital, then lower case letters.
Example
Below is an example of how to format these types as a single item, and as a list of items: