Add request blocks to your notebook

View as Markdown

Add API requests to your notebook to create an interactive experience. For example, you can add an input block for your API consumer’s email address and use a request block to send them a welcome message.

You can also reference a request block’s response elsewhere in your notebook and send requests in sequence.

Add a request block

To add a request block, do the following:

  1. Open your notebook or create a new one.
  2. Place your cursor where you want to add the request block. Then, enter a forward slash (”/”). Postman displays a block menu.
  3. Choose Request icon Request Block.
  4. Search for your public request or paste its URL or UUID. Then, select it. Postman displays the request, any variables you or your API consumers may need to define, a way for you or your API consumer to define the request body, and a button to send the request.
  5. Name your request block.
  6. If necessary, define the variables. These may include query and path parameter values, or other values defined in the request.
  7. (Optional) Define an override. This overrides the request’s body.
  8. Click Run icon Send.

Postman sends the request and returns the response.

If the request changes, you can refresh the request block. To refresh it, next to the endpoint, click Refresh icon Refresh. To start over, click Clear icon Clear.

Reference your request block

Reference your request block by name. For example, if you name your request block “getUser”, you can reference its response with the syntax {{getUser}} in text, an input block, another request block, or an AI request block.

Or you can reference it with the syntax $getUser in a script runner block.

Furthermore, you can use dot notation to reference data within the response. For example, in another request block, you can reference the user’s first email with the syntax {{getUser.emails.0}}. Or in a script runner block, you can reference the same value with the syntax $getUser.emails[0].

To reference your request block, do the following:

  1. Open your notebook or create a new one.

  2. Get your request block’s name.

  3. Reference your request block:

    • To reference your request block in text, an input block, another request block, or an AI request block, use the syntax {{requestBlockName}} or {{requestBlockName.path.to.data}}.
    • To reference your request block in a script runner block, use the syntax $requestBlockName or $requestBlockName.path.to.data.

Send requests in sequence

If you can use the data from one response in the request of another, you can send those requests in sequence. For example, you can get a user’s email from a response and use it to send a different request.

To send requests in sequence, do the following:

  1. Open your notebook or create a new one.
  2. In the first request block, click Run icon Send.
  3. In the second request block, reference the first request block with the syntax {{requestBlockName.path.to.data}}. Then, click Run icon Send.

Postman uses the first request’s response to send the second request. You can add more requests to the sequence.