HTTP Request

You can send requests in the process flow to connect to APIs you are working with or integrate with a third-party API.

HTTP Header

If you have a request you want to run, you will need to know the method, URL and other optional keys and values. Choose HTTP Request on the command list then it will show as images below.

Component Explanation:

NameDescription

Http Request Name

The node_id in the workflow component.

Method

Method of HTTP Request is supported GET, POST, PUT, DELETE, and PATCH.

URL

The API you want to hit (the link you want to access). The URL is dynamic, URL can use parameters, depending on the variable to be displayed.

Key

Variable name (can use parameters that don't have to be static).

Value

Value of the variable (can use parameters that don't have to be static).

+ HTTP Header

Button to add header (keys and values).

Play

To execute the node_id that was made.

Add

To save the node_id in a workflow.

A. Request Methods

Currently, there are 5 methods that you can use for retrieving data from an API in the process flow, i.e., GET, POST, PUT, DELETE, and PATCH.

B. Setting Request URLs

Each request you send in the process flow requires a URL representing the API endpoint you are working with. Each operation you can perform using an API is typically associated with an endpoint. Each endpoint in an API is available at a particular URL, this is what you enter into process flow to access the API.

If you're building an API, the URL will typically be the base location plus path. For example :

Description of URL :

  1. {URL}: Used to pass information to the destination.

  2. {Path}: Location of data on the server.

If you're using a third-party API, your API provider will supply the URLs you need, for example within their developer documentation.

You can optionally type query parameters into the URL field. Any word after the question mark (?) in a URL is considered to be a parameter that can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&". For example:

URL provides dynamic variables that you can use in your requests. Each variable name represents its key, so referencing the variable name allows you to access its value. The variable name is typically taken from the previous process.

Consider the workflow example below.

In the image above (Process Flow 'Kurs Mata Uang'), we take the example of the ‘getKurs' process. This process is to provide a feedback response to requests.

This ${getEntity.response} variable is to contain the response of the ‘getEntity’ process. Or, you can add ${getEntity.response} using the response (output) from the ‘getEntity’ process, such as images below.

Consider the workflow example below.

In the image above (Add Gitlab Issue Workflow), we take the example of the 'addGitlabIssue' process. This process is to provide a feedback response to requests sent, this response is in the form of a 'title' object whose value is ${response.title}. This ${response.title} variable is to contain the response title of the 'transformIssue' process.

The ${response.title} variable will not be able to process on 'getChatlink'. Because, before the ‘getChatLink’ process there were 2 processes i.e 'addGitlabIssue' process and 'getToken', when you input the variable ${response.title} in 'getChatlink' the system will be confused to determine the title variable to be accommodated, whether the variable to be accommodated is a response from the 'addGitlabIssue' process or a response from the 'getToken' process.

C. Setting Request Header

Some APIs require you to send particular headers along with requests, typically to provide additional metadata about the operation you are performing. You can set these up in the Headers tables. Enter any key-value pairs you need and the process flow will send them along with your request. Variables allow you to store and reuse values in your requests. Using variables increases your ability to work efficiently and minimizes the likelihood of error.

For example, to include authorization in the request headers, you can set header in the request node id ‘getToken’, This request serves to retrieve the token variable from the API contained in the URL and will hold the variable as a response.

To get a token from the 3Dolphins application, a request body in the form of a 3Dolphins account is required. This 3Dolphins account functions as authentication on API Rest, so only 3Dolphins users can use the 3Dolphins API.

When the request is executed, then the response will be obtained in the form of an access token.

In the image above (Image Add Gitlab Issue Workflow), we take the example of the ‘getChatLink’ process. This process is to provide a feedback response to requests sent, this response is in the form of an ‘Authorization’ object whose value is ‘${getToken.response.token}’. This ‘${getToken.response.token}’ variable is to contain the response token of the ‘getToken’ process.

HTTP Body

The 'HTTP body' tab in the process flow allows you to specify the data you need to send with a request. You can send various different types of body data to suit your API.

If you’re sending body data, make sure you have the correct headers selected to indicate the content type your API may need to process the received data correctly. Typically you will use body data with POST requests.

In the image Add Gitlab Issue Workflow, we take the example of the 'getToken' process. to get access token requires a request body such as a 3Dolphins account. This 3Dolphins account functions as an authentication on API Rest, so only 3Dolphins users can use the 3Dolphins API.

HTTP Response

Once your headers and other request details are set up, you can click 'Play' to run your request and examine the response received from the API server. If your request does not work as expected, check out some errors.

In the image above (Image Add Gitlab Issue Workflow), we take the example of the 'addGitlabIssue' process, to be able to add issues to gitlab, which needs the destination URL (server API) and parameters will be sent to the gitlab. For example in the ‘addGitlabIssue’ process, the parameters that will be sent are title, description and label. When the 'addGitlabIssue' process is run, you will get a response (this response will be sent to gitlab) like in the picture below.

Last updated