Build a Custom API Action card
A Custom API Action (CAPIA) is an action card available on a connector that allows the end user to make an authenticated HTTP request to the service in question. The base url is hard coded into the connector, so users only need to add the relative url for the endpoint. They then manually create the required objects for header, query, and/or request body if necessary. The CAPIA then returns data from the service as three outputs: Status Code, Headers, and Body.
-
Create a new flow under the Flows tab by clicking + New Flow in the upper right corner of the page.
-
At the far left of the page, click on the Action button.
-
Click the Save button in the toolbar and name the flow
Custom API Action
. -
In the flow description field, type
Make an authenticated HTTP request to the {your service} API
, check the Save all data that passes through the Flow box, and click Save. -
Click on the Add Options button on the Connector Action card.
-
Click the Add Field button and add a field with the label
Request Type
and a type of Dropdown: Static Values. -
Click the Add Option button to add a row for each request type the user can choose for your API: GET, PATCH, POST, PUT, DELETE. You’ll need to populate both the Option and Value fields with the same text. You don't need to select a Default.
-
Make sure the field is marked as Required and click Save.
-
Click on the Add Inputs button on the Connector Action card.
-
Click the Add Field button and add the following fields with data types and click Save.
-
Relative URL (Text) Required
-
Query (Object)
-
Headers (Object)
-
Body (Object)
-
Add a Flow Control Call Flow card as the first card in the flow.
-
Click on the Choose Flow button.
-
Select the httpHelper flow created previously. The card will automatically populate with the inputs defined in the httpHelper flow.
-
Drag the Relative URL output from the Connector Action card into the relative_url input on the Call Flow card.
-
Drag the Request Type output from the Connector Action card into the request_method input on the Call Flow card.
-
Drag the Query output from the Connector Action card into the query input on the Call Flow card.
-
Drag the Headers output from the Connector Action card into the headers input on the Call Flow card.
-
Drag the Body output from the Connector Action card into the body input on the Call Flow card.
-
For the outputs on the Flow Control Call Flow card, you’ll need to define the same keys as on the httpHelper flow’s outputs:
-
status_code (Number)
-
headers (Object)
-
body (Object)
- Click the Add Outputs button on the Return Outputs card.
- Click the Add Field button to add the following three new fields with data types and click Save.
-
Status Code (Number)
-
Headers (Object)
-
Body (Object)
-
Drag the outputs from the Call Flow card to the corresponding inputs on the Return Outputs card.
-
Drag the auth object from the Connector Authping card to the Connection input field of the Call Flow card.
-
Save and test your flow by manually adding a request_method, relative url, and any other data to the test dialog.