Send URL-encoded or form data to flows
The Request block can get input data for your flow from a scenario. That enables you to test the flow locally. This topic explains how to create scenarios for Request blocks in flows whose HTTP request bodies need to be formatted as form-data or x-www-form-urlencoded data. For flows whose request bodies will only require plain JSON, skip this topic and follow the Request block setup instruction instead.
Create and deploy the flow
-
Create a deployable flow and include an HTTP Request block with an HTTP request.
-
Click Deploy and enter a URL.
-
Click Deploy.
-
Click Current, then click
Open in HTTP request to open the HTTP request editor.
Edit the request
-
In the HTTP request editor, select the POST request method.
-
(Optional) Configure parameters, authorization, headers, scripts, and settings as desired.
-
Configure the request body in the Body tab. Choose one of the following two options, depending on whether your flow will require its HTTP request body to be formatted as
x-www-form-urlencodedorform-data:-
Option one: Select x-www-form-urlencoded, then enter the keys and example values.
-
Option two: Select form-data, then enter the keys and example values for your form fields.
Form data values are of type
Textby default, but you can alternatively selectFile, add a file. If the file hasn’t been uploaded to the Postman cloud yet, clickUpload file to team to make it available to your teammates.
-
-
Save and send the request.
-
Assuming that the flow responds with
200 OK, clickHome > Analytics.
Obtain the request body
-
In the Flow column, click the name of the flow you’re sending requests to, to open its details at right.
-
Under Run Logs, click Request to reveal details. In the Body section, click
Copy to copy the request body.
-
Click Open flow to return to your flow.
Work with the request body
-
In your flow, create a scenario, and in the Body field, paste the request body that you copied while in the request editor.
-
Save and run the scenario.
-
Click the Body port of the Request block to open the block footer, and verify that the block emitted the correct request body, headers, and parameters.
-
Based on the correctly formed request body that’s available in the block footer, add blocks to your flow to process the request body data as desired.