Rest API
Last updated
Last updated
The REST API Component facilitates interactions with external systems or services through HTTP requests and responses. This component enables seamless integration with third-party APIs and allows the exposure of custom endpoints for external systems to interact with the flow.
Add Rest API Component to Canvas:
This sets the stage for your flow to interact with external systems or services. To add the Rest API components to the canvas, you have two options:
Navigate through the components menu in the side panel, and drag the Rest API component onto the canvas of your workflow.
Click the plus icon, which opens a window allowing you to search for various components and connectors. Search for the Rest API component and select it.
Each component will be labeled with a unique identifier (e.g., rest_api_1) for easy reference if multiple Rest API components are used.
Access REST API Component Settings:
Click on the Rest API Component to access its settings. This is where you define how your flow communicates with external resources.
Select Credentials for Rest API Connection:
Choose a credential stored in your CXFabric tenant from the dropdown list.
Selecting Method:
Choose the HTTP method that aligns with your intended operation:
GET
: Retrieve data from the API.
POST
: Send data to the API.
PUT
: Update existing data on the API.
PATCH
: Partially update an existing data on the API.
DELETE
: Remove data from the API.
Enter Endpoint/URL:
Define the specific URL or URI endpoint representing the resource or collection of resources on the server. For example, in the URL https://api.example.com/users, /users is the endpoint that refers to the collection of user resources.
Adding Parameters:
Parameters are additional data required by the API endpoint. These are often specified in the API documentation. To add a parameter, click ADD PARAMETER button, then enter the key (e.g., username) and value. These parameters will be included in the API request.
Adding Headers:
Some REST APIs require headers for authentication or other purposes. These headers are also specified in the API documentation. To add a header, click ADD HEADER button, then enter the key and value.
Select Payload Content Type Choose the format of the payload you are sending.
Form Data: Key-value pairs are sent as form data.
JSON: Payload is sent in JSON format (default option).
Enter Payload Data:
Depending on the selected content type, enter the required payload data. This data is typically specified in the API documentation and is needed for the API to process the request.
Submit:
Click the submit button to confirm your REST API settings. This finalizes the configuration and instructs the REST API Component on how to structure and execute the HTTP request.
Hover for Information:
Hover over the REST API Component on the canvas to see a tooltip. This tooltip provides a quick reference to the configured settings and ensures clarity about your API integration.
Execute the Rest API Component:
Hover your mouse over the Rest API Component to display the action buttons then click the play button to execute the step. The execution result can be viewed in the logs panel.
NOTE:
Always refer to the API documentation for the correct endpoint, parameters, headers, and authentication type.
Ensure that any sensitive information (e.g., API keys, tokens) is stored securely and not hard-coded within your workflow.
Test your API calls with sample data to ensure they are configured correctly before deploying your workflow.
Click the ellipsis menu next to the credential selection dropdown to manage credentials (add, edit, view, delete). Click "Manage" to access the full list in the Credential Management page.