Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Overview
Excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Actionflows API endpoints can be setup to provide an API end point which enables set up in PhixFlow to enable external systems to make calls to PhixFlow. Actionflows set up as API end points API endpoints have a
|
Versions
This functionality has been enhanced between version versions 10, 11 and version 11, please 11.1.1+. Please refer to the relevant section below.
Expand | ||
---|---|---|
| ||
Name | Type | Description |
body | String | provides the information sent in the body of the API call. |
contentType | String | Provides details of the Content Type |
headers | String | Provides the information sent in the API call header. |
url | String | Provides the complete URL that was used to call the API. This can be used to pass parameters to the API. |
parameter | description | |
<<Server Name>> | URL of the server e.g. app.phixflow.com | |
phixflow | the name of the instance, typically this is phixflow | |
<<Actionflow Name>> | The name of the actionflow set in Step 1. Note that if your actionflow has a space in the name this must be replaced with %20. For example "My API" becomes, "My%20API". |
Version 11
Incoming API Setup
To enable an actionflow as an incoming API, we need to define it as an end point and configure an incoming connection point with a set of predefined input parameters. These settings are described below:
Step 1 - Actionflow Properties
Create an- Note if using a pre 10.1 version of PhixFlow the name must be unique across all applications.
- This turns the Actionflow into an incoming API.
Excerpt | ||
---|---|---|
| ||
This allows anyone with the URL for the API to call it, the audit trail records the system as running performing the API call. |
Step 2 - Input Connection Point Input Parameters
Incoming APIs require a specific set of Input Parameters on the connection point.
- Click on the Connection Point In
- In the Properties that open, in the Input Parameters section add the following attributes, the names are case sensitive:
Step 3 - Configure your Actionflow
- Configure the Actionflow to perform the required tasks, for example return all company data , or pass in a date and return all companies onboarded after this date.
- If you wish to return data from the API,
- Add a new Connection of type Output
- The name of the Output Connection Point will be used to retrieve the data as part of the path. This is covered in Calling a PhixFlow API below.
- Add the required Output Attributes i.e. the data you wish the API to return.
- Add a new Connection of type Output
Calling a PhixFlow API
Step 4 - HTTP Method and API Mode
- HTTP Method
- To call a PhixFlow API use the HTTP Method GET or POST:
- GET simply calls the API with data passed in the body of the request.
- POST calls the URL and sends data in the body of the request. The body data is passed into the body attribute of the Actionflow setup above as an Input Connection point.
- API Mode
- Wait for result (Synchronous) (Default): The API waits for the results or the timeout to occur. Note: If the timeout occurs the command is aborted.
- Poll for result (Asynchronous): The API is called and a response is returned immediately including the process ID. Subsequent API calls can be made using the process ID to fetch the status of the action. The asynchronous mode can be thought of as “fire and forget”.
Step 5 - API URL
The API URL can be found in the Actionflow Properties → API Section → URL value
Example URL: https://app.phixflow.com/phixflow/api/1/action/MyApp/My%20API/trigger
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
parameter | description | |||||||||
<<Server Name>> | URL of the server e.g. app.phixflow.com | |||||||||
phixflow | the name of the instance, typically this is phixflow | |||||||||
<<Application Name>> | The name of the application where the Actionflow resides. | |||||||||
<<Actionflow Name>> | The name of the actionflow set in Step 1. Note that if your actionflow has a space in the name this must be replaced with %20. For example "My API" becomes, "My%20API". |
| ||||||||
Version 11.1.1+Incoming API Setup
For a worked example, see 3.11 Setting up an API Endpoint. |
Expand | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Version 11Incoming API SetupTo enable an actionflow as an incoming API, we need to define it as an end point and configure an incoming connection point with a set of predefined input parameters. These settings are described below: Step 1 - Actionflow Properties
Step 2 - Input Connection Point Input ParametersIncoming APIs require a specific set of Input Parameters on the connection point.
Step 3 - Configure your Actionflow
Calling a PhixFlow APIStep 4 - HTTP Method and API Mode
Step 5 - API URLThe API URL can be found in the Actionflow Properties → API Section → URL value Example URL: https://app.phixflow.com/phixflow/api/1/action/MyApp/My%20API/trigger
Step 5.1 - API Status Check (Poll for Result)
Step 6 - Returned Data JSON PathIf your API has been configured to return data the path will be in the format:
Where <<Output Name>> is the Output connection point setup in step 3. Adding AuthenticationStep 7 - Enable Authentication
Step 8 - Create an Authentication User
Step 9 - Authentication Token KeyStoreA signing key is used to generate the Phixflow API key and this is stored on the server to ensure secure access. Using the page Configure a Keystore and Aliases, configure phixflow-api-key to be used as the signing key for PhixFlow API Keys in the same way as the pepperKey is configured. This secret string must be a minimum of 32 bytes length. Step 10 - Generate Authentication Token
Step 11 - Send AuthorizationWhen calling the Incoming API, the authorisation token must be passed in as a header called: Server Console ResponsesThe item calling the API End-Point will receive the a Response from the API End-Point stating whether it has run successfully (Success) or not (Fail). Responses can be customised to return specific messages. The response recorded in the
If you are making the call using PhixFlow the Responses can be access as follows:
API End-Point ResultsTo see the results of the API End-Points processing in the
FailuresAn API End-Point will fail if the logic in the Actionflow fails or if the error() function is used to force a failure. If records are passed to the API End-Point individually a failure will only impact the specific record being processed. |
Expand | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||
Version 10Incoming API SetupTo enable an actionflow as an incoming API, we need to define it as an end point and configure an incoming connection point with a set of predefined input parameters. These settings are described below: Step 1 - Actionflow Properties
Step 2 - Input Connection Point Input ParametersIncoming APIs require a specific set of Input Parameters on the connection point.
3. Apply your changes Step 3 - Configure your ActionflowConfigure the actionflow to perform the required tasks. If you wish to return data from the API,
Calling a PhixFlow APIStep 4 - HTTP MethodTo call a PhixFlow API use the HTTP Method POST Step 5 - API URLThe API can be called using a URL which is constructed as follows: https:// |
Step 5.1 - API Status Check (Poll for Result)
$.processId
- This can be accessed in an Output attribute using,
_result.value
trigger
Example URL |
Step 6 - Returned Data JSON PathIf your API has been configured to return data the path will be in the format:
Where <<Output Name>> is the Output connection point setup in step 3. Adding AuthenticationStep 7 - Enable Authentication
|
|
Step 8 - Create an Authentication User
|
|
|
|
|
|
|
|
|
Step 9 - Authentication Token KeyStoreA signing key is used to generate the Phixflow API key and this is stored on the server to ensure secure access. Using the page Configure a Keystore and Aliases, configure phixflow-api-key to be used as the signing key for PhixFlow API Keys in the same way as the pepperKey is configured. This secret string must be a minimum of 32 bytes length. Step 10 - Generate Authentication Token
|
|
Step 11 - Send AuthorizationWhen calling the Incoming API, the authorisation token must be passed in as a header called: Server Console ResponsesThe item calling the API End-Point will receive the a Response from the API End-Point stating whether it has run successfully (Success) or not (Fail). Responses can be customised to return specific messages. The response recorded in the |
Console: If you are making the call using PhixFlow the Responses can be access as follows:
API End-Point ResultsTo see the results of the API End-Points processing in the |
Console:
FailuresAn API End-Point will fail if the logic in the Actionflow fails or if the error() function is used to force a failure. If records are passed to the API End-Point individually a failure will only impact the specific record being processed. |