How to pass JSON data using HTTP Request action
There are times when you may want to post JSON data to a specific URL or a web application. To achieve this, you can use the ‘HTTP Request’ action in your workflow. This action lets you make HTTP requests (including POST requests) through your workflows. Let’s understand how this works with the help of an example.
Let’s say you wish to post your first name and company name to a specific URL. To do this, follow the steps given below:
Step 1: Add ‘HTTP Request’ action
Add ‘HTTP Request’ action to the canvas and connect it to ‘Start’ and ‘Stop’ buttons.
Step 2: Configure the action
Configure the action as given below:
Method: Since we need to post data, select ‘POST’ action from the dropdown list.
URL: Enter the URL to which you wish to post data.
Next, click on the ‘+’ icon given beside ‘Header’ tab to add header data. A new ‘Header’-’Value’ pair will appear.
Header: Enter ‘Content-Type’ as the header name.
Value: Enter ‘application/json’ as the value for the specified header.
To add the JSON data in the body of the ‘HTTP Request’, select ‘raw’ from the list of options and enter your JSON data in the textbox that appears.
After configuring the action, click ‘Next’. In the next window that appears, you will see a ‘Test’ button.
When you click ‘Test’ button, Built.io Flow will test the action. This checks whether the action has been configured properly and displays the data in the ‘Output’ tab.
Click on ‘Done’. This will bring you back to the canvas. Then click on the 'Run' icon located at the top right-hand side corner of the canvas to run the workflow. This will post the JSON data to the specified URL.