API Endpoint SetupAPI endpoints must be made using the specific option on the Insert excerpt |
---|
| _actionflow |
---|
| _actionflow |
---|
nopanel | true |
---|
| homepage to ensure a URL is generated and a set of predefined input parameters are configured on the incoming connection point. Iframe |
---|
allowfullscreen | true |
---|
src | https://www.youtube.com/embed/fuh5kkeufWI?si=45Jk2d5Zr298SVxz?&rel=0&ytp-pause-overlay |
---|
width | 680 |
---|
align | middle |
---|
height | 400 |
---|
|
- Create a new
Insert excerpt |
---|
| _actionflow_api_endpoint |
---|
| _actionflow_api_endpoint |
---|
name | text |
---|
nopanel | true |
---|
| on the Insert excerpt |
---|
| _actionflow |
---|
| _actionflow |
---|
nopanel | true |
---|
| homepage using the Image Modified option- Image Modified
- Set a unique name and provide a useful description
- If you have made your API Endpoint via the
Insert excerpt |
---|
| _repository |
---|
| _repository |
---|
nopanel | true |
---|
| , right-click on the API Endpoint name and choose Insert excerpt |
---|
| _actionflow_icon |
---|
| _actionflow_icon |
---|
nopanel | true |
---|
| Display
- The API Endpoint
Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
| will open on the right - for the full Properties list, see API Endpoint Properties- In the Basic Settings section, enable Allow Anonymous Connections
Excerpt |
---|
name | AllowAnonymousConnections |
---|
| This allows anyone with the URL for the API to call it. The audit trail records the system as running performing the API call. |
Adding authorisation is covered on API Authentication and Secret Keys.
- Copy the URL and save it locally, to be used later when calling the API
Example URL: https://app.phixflow.com/phixflow/api/1/action/MyApp/My%20API/trigger
Expand |
---|
| The structure of the URL is as follows: https://<<Server Name>>/phixflow/api/1/action/<<Application Name>>/<<Actionflow Name>>/trigger 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". |
|
- Set the 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”
- Set a Timeout (optional):
Specify a maximum time in milliseconds that the API will wait for before the command is aborted When a Timeout value is set, it overrides the default timeout, which is 60 seconds where API Mode is Synchronous and 500 milliseconds where API Mode is Asynchronous However, if a timeout parameter has been provided in the URL calling this API, that will override both this Timeout value and the default value
- your changes
- 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
- See Worked Example below for an example setup
Insert excerpt |
---|
| _actionflow_api_endpoint |
---|
| _actionflow_api_endpoint |
---|
name | text |
---|
nopanel | true |
---|
| s have fixed parameters set on the input node (body, headers, contentType and url), and the output node (body, headers, contentType and statusCode) which can be mapped to.
Image Modified On the Input Connection Point, additional Input Parameters can be created to facilitate query string parameters being passed into the API via the URL. - Click on the node
- The
Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
| will open on the right and in the Input Parameters section, click the Insert excerpt |
---|
| _add_icon |
---|
| _add_icon |
---|
nopanel | true |
---|
| icon to create a new attribute - Enter a Name and Default Value (optional)
The Name set on the must match the parameter name in the URL, e.g. if an Input Parameter, "field" is created, and the request URL is https://server/phixflow/api/1/action/App/Api/trigger?field=abc then the value "abc" will be used as a parameter. When calling APIs using query string parameters in the URL, care should be taken to ensure that the values are appropriately URL encoded to prevent unexpected behaviour. See HTTP Action Configuration. If a parameter is missing then it will be marked as unavailable, unless a Default Value has been configured.
Note |
---|
“timeout” is a reserved value that controls the timeout of the request and cannot be used as a parameter. |
API Status Check (Poll for Result)- If calling a PhixFlow Asynchronous API only, a result will be immediately returned which includes a Process ID for that run
- The Process ID is returned on the path:
$.processId - This can be accessed in an Output attribute using,
_result.value
- The Process ID can be used to call the following URL which will return the current state of the run:
- https://<<Server Name>>/phixflow/api/1/action/<<Application Name>>/<<Actionflow Name>>/poll/<<processID>>
Calling a PhixFlow APIHTTP MethodThis is set on the Insert excerpt |
---|
| _action_http |
---|
| _action_http |
---|
nopanel | true |
---|
| action on the Actionflow calling the API.- 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 API as an Input Connection point
Returned Data JSON PathIf your API has been configured to return data the path will be in the format: $.data.<<Output Name>>
Where <<Output Name>> is the Output connection point. Server Console ResponsesThe item calling the API endpoint will receive the Response from the API endpoint stating whether it has run successfully (Success) or not (Fail). Responses can be customised to return specific messages. The response recorded in the Insert excerpt |
---|
| _console |
---|
| _console |
---|
nopanel | true |
---|
| :If you are making the call using PhixFlow the Responses can be access as follows: - Click the Actionflow entry
- Image Modified
- In the Messages section which is opened below, double-click the lines that begin Response
- Image Modified
- Click the Message Details tab to see the response
API Endpoint ResultsTo see the results of the API Endpoint processing in the Insert excerpt |
---|
| _console |
---|
| _console |
---|
nopanel | true |
---|
| :- Click the Actionflow entry for the API Endpoint
- In the Messages section which is opened below, double-click any of the Messages to see more details
- If you are using a debug() statement these will appear here
FailuresAn API Endpoint 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 Endpoint individually a failure will only impact the specific record being processed. Error Codes200- Occurs if the output of an API Endpoint is not connected
400 |