Send request

Send Request block

Runs a request in a collection and outputs the result. If the request includes a saved example, you can use the result as test data to run the Flow and autofill Select blocks.

Select a Request - Select a collection and a request.

Send - If you connect another block to this input node, that block triggers this block to run.

Success - Has the response of a successful API request. If Postman tests are assigned to the request and all pass or, if there are no tests, a 2xx (successful) HTTP status code is received. The information returned by the request is then output to the next block.

Failure - Has the response of an unsuccessful API request. If Postman tests are assigned to the request and all fail or, if there are no tests, a non 2xx (unsuccessful) HTTP status code is received. The information returned by the request is then output to the next block.

Example

Authenticate an API in Postman Flows

Most APIs require some form of authentication. Authentication adds security to an API so that only the intended users can access and update information. Postman Flows recognizes supported APIs that require authentication, and prompts you to set up authorization in the Send Request block. You can also add your API key to the Send Request block as a value.

Read about the different types of authentication and how to use them.

Getting an API key

This example uses the Stocks Price Flow template. This Flow is already built but needs an API key to run. API keys are a series of letters and numbers that uniquely identifies who can use the API. This request has a variable api key which will pass the value of the variable in the request.

Getting an API key

Selecting the link in the Flow opens the page to get an API key. Enter any organization name and an email and copy the key generated below.

Adding an API key to the Send Request block

For this example, you don't need to secure the API key, so it can be pasted directly in the api key value in the Send Request block.

Postman recommends using your Postman Vault to store sensitive data, such as API keys, as vault secrets. Only you can access and use your vault secrets, and vault secrets aren't synced to the Postman cloud. If you want to share sensitive data with collaborators or access it in scripts, you can store it in an environment as a secret type variable.

Learn more about the differences between vault secrets and variables.

Setting up authorization from the Send Request block

When you create a Send Request block with a request that requires No Auth authorization, you'll be prompted to set up authorization for the request.

Set up authorization

Select set up authorization to add your API key to the request.

Select values with the Select block

API requests often return a lot of information. In many cases, when using the information to perform a task, only some values are used. This is where the Select block is useful for picking one value at a time to work with.

Selecting information using the Select block

Use the Select block when more than one value is returned. It's almost always used after a Send Request block because Send Request blocks always return more than one value.

Select block

You can also create a Select block by dragging and dropping output data from a Send Request or Output block. The new Select block automatically selects the data you dragged and dropped.

Select block

When you connect a Select block to a block that has already run or has a saved example, you can select a value from the block's output. This example (which uses the currency conversion API from the spotlight examples) selects eur, which automatically generates the structure to get that value. In this case, the request returns a set of data called body, which holds the two date and eur values. All requests have a data set named body, but the structure varies depending on the API being used.

Using the results

After selecting the value you want, that information will be the Select block's output.

Add an Output block to show information in various formats (like images, videos, graphs, and more) directly on the canvas when you run the Flow.

View the value with an Output block

Last modified: 2024/07/01