Use FlowMattic API Module for Connecting Applications via API
Overview
The FlowMattic API module allows seamless integration with any application that provides an API and relevant documentation. By leveraging this module, you can perform various API requests such as GET, POST, PUT, DELETE, and PATCH. This guide provides a detailed walkthrough for connecting to an API, using Google Maps API as an example.
Steps to Connect an Application via FlowMattic API Module
Let’s try using the Google Maps API in the following steps as an example.
-
Create a Workflow:
- Start by creating a new workflow in FlowMattic.
- Add an action step and select the API module.
-
Configure API Module:
- Choose the action event, e.g.,
GET
,POST
, or other supported methods. - Enter the API Endpoint URL provided by the application you are connecting to. For example, to retrieve the distance between two locations using Google Maps API, use the URL:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=Toronto&destinations=Montreal
.
- Choose the action event, e.g.,
-
Set Authentication:
- Select the appropriate authentication method:
- No Authentication: For APIs that don’t require authentication.
- Basic Auth: Use a username and password for authentication.
- Bearer Token: Provide a token for secure access.
- FlowMattic Connect: Use pre-configured FlowMattic Connect for OAuth 2.0 and different other authentication types.
- Select the appropriate authentication method:
-
Enable Headers and Parameters:
- Enable the Headers option if the API requires specific headers, and add them accordingly.
- Enable the Parameters option and input the required key-value pairs. For example:
Key: key Value: Your Google Maps API key
-
Set Response Format:
- Choose the response format as
Simple
or any other format as required by the API.
- Choose the response format as
- Test the API Connection:
- Navigate to the
Test
tab and click theTest Action
button. - Review the response in the
Data-out
tab to ensure the connection is successful.
- Navigate to the
Supported HTTP Methods
The FlowMattic API module supports the following methods:
- GET: Retrieve data from the server.
- POST: Submit data to the server.
- PUT: Update data on the server.
- DELETE: Remove data from the server.
- PATCH: Partially update data on the server.
Understanding the API requirements for your app
- API Endpoint: The URL where the API is hosted.
- Authentication: The method required to access the API (e.g., API key, OAuth 2.0, etc.).
- Headers: Additional information required by the API (e.g., content-type).
- Parameters: Key-value pairs to be sent with the API request.
- Response Format: The format in which the API will return the data (e.g., JSON, XML).
- Request Type: The type of request to be made (e.g., GET, POST).
All of the above details can be found on the API documentation of the application you are connecting to. Some apps provide the API request examples in their documentation to help you get started. Let’s try to explore a sample to help you understand how you can retrieve the required details from such documentation.
Let’s assume the following is an example request shared on your apps documentation page, which uses the CURL command to send some sample data to your app’s API endpoint:
curl -X POST "https://api.example.com/data"
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
-d '{"key_1":"value1","key_2":"value2"}'
From the above example, you can extract the following details:
- API Endpoint:
https://api.example.com/data
- Authentication: Bearer Token
- Headers:
- Content-Type: application/json
- Accept: application/json
- Parameters:
- key_1: value1
- key_2: value2
- Request Type: POST
You can use these details to configure the FlowMattic API module to connect to your app’s API as shown in the screenshots above.
Tips for Using FlowMattic API Module
- Always refer to the API documentation of the application you are connecting to for accurate endpoint URLs, headers, and parameters.
- Use test actions in FlowMattic to validate your API configurations before proceeding further in your workflow.
- For OAuth 2.0 and different authentication types, use pre-configure FlowMattic Connect to simplify the process.
By following these steps and tips, you can efficiently connect and interact with APIs using the FlowMattic API module.
For any further assistance or queries, please feel free to reach out to our support team.