How to Build an API Request Body Using Output From Previous Cards in Okta Workflows

In this guide:

Okta Workflows guides offer questions and answers from the Okta Workflows community office hours. They also come from the #okta-workflows channel on the Mac Admins Slack, as well as other places. Read all the other guides.

How do you build an API request body using output from previous cards in Okta Workflows?

This guide will teach you how to build an API request body using output from previous cards in Okta Workflows.

The guide will use the Postman Echo API for demonstration.

Get request

This flow shows how to build a GET request using output from previous cards — combining a URL, query parameters, and headers into the API Connector-Get card. Unlike the POST example, a GET request doesn’t include a body.

A workflow showing four connected cards: a Text Compose card containing a Postman echo GET URL (https://postman-echo.com/get?userId=1001) mapped to a URL output, two Object Construct cards building query parameters with fields for title (Automation), subject (A book about automation), workflows-app-name (Workflows), and workflows-app-id (1000), and a final API Connector Get card with Request fields for URL, Query, and Headers mapped from the previous cards, and a Response section showing Status Code, Headers, and Body outputs.
GET request.

How the flow works

  1. The Text-Compose card creates the request URL: https://postman-echo.com/get?userId=1001.
  2. The first Object-Construct card builds the query parameters — an object with the following fields:
    • title=Automation
    • subject=A book about automation
  3. The second Object-Construct card builds the request headers — an object with:
    • workflows-app-name=Workflows
    • workflows-app-id=1000
  4. The API Connector-Get card sends the GET request, using the URL from the Text-Compose card and the query and headers objects from the two Object-Construct cards.

Output

When you run the flow and make a request to the Postman API, Postman returns (echoes) the data it received. The API Connector-Get card Body field returns the following:

JSON
{
"args": {
"userId": "1001",
"subject": "A book about automation",
"title": "Automation"
},
"headers": {
"host": "postman-echo.com",
"workflows-app-name": "Workflows",
"user-agent": "Azuqua",
"workflows-app-id": "1000",
"x-forwarded-proto": "https",
"accept-encoding": "gzip, br"
},
"url": "https://postman-echo.com/get?userId=1001&subject=A%20book%20about%20automation&title=Automation"
}
  • The args object shows the query parameters — combining the userId from the Text-Compose URL with the subject and title from the query object.
  • You can see the workflows-app-name and workflows-app-id values in the headers object.
  • The url field shows all three query parameters appended to the request URL.

Post request

JSON body flow

This flow shows how to make a POST request. The flow uses cards to create the URL, query, headers, and body fields for the request.

A workflow showing five connected cards: a Text Compose card with a Postman echo URL, three Object Construct cards building an API payload with fields for app name (Workflows), app ID (1000), title (Automation), subject (A book about automation), and user IDs (1000, 1001), and a final API Connector Post card mapping the constructed objects to URL, query, headers, and body fields, with a Response section showing Status Code, Headers, and Body outputs.
POST request.

How the flow works

  1. The Text-Compose card creates the request URL: https://postman-echo.com/post?test=yes
  2. The first Object-Construct card builds the query parameters — an object with:
    • api=postman
  3. The second Object-Construct card builds the request headers — an object with:
    • workflows-app-name=Workflows
    • workflows-app-id=1000
  4. The third Object-Construct card builds the request body — an object with:
    • title=Automation
    • subject=A book about automation
    • userId=1001
  5. The API Connector-Post card sends a POST request to the URL from the Text-Compose card, using the body, headers, and query objects from the three Object-Construct cards.

Output

When you run the flow and make a request to the Postman API, Postman returns (echoes) the data it received. The API Connector-Post card Body field returns the following:

JSON
{
"args": {
"test": "yes",
"api": "postman"
},
"data": {
"subject": "A book about automation",
"title": "Automation",
"userId": 1001
},
"files": {},
"form": {},
"headers": {
"host": "postman-echo.com",
"content-length": "72",
"workflows-app-id": "1000",
"content-type": "application/json",
"user-agent": "Azuqua",
"workflows-app-name": "Workflows",
"x-forwarded-proto": "https",
"accept-encoding": "gzip, br"
},
"json": {
"subject": "A book about automation",
"title": "Automation",
"userId": 1001
},
"url": "https://postman-echo.com/post?test=yes&api=postman"
}
  • The args JSON object shows the query parameters
  • The data object shows the body parameters
  • You can see the workflows-app-name and workflows-app-id values in the headers object.
  • The url field shows the query parameters appended to the request URL — test=yes from the Text-Compose URL and api=postman from the query object.

URL-encoded body flow

The URL-encoded body flow sends a POST request with the body encoded as a key=value&key=value string instead of a JSON object. The Content-Type header is explicitly set to application/x-www-form-urlencoded so that Postman Echo parses the body correctly.

A workflow showing an API Connector Post card configured with a URL-encoded body. The Request section includes fields for URL, Query, Headers, and Body, with the Body field containing URL-encoded key-value pairs. The Response section shows outputs for Status Code, Headers, and Body.
Post request with URL-encoded body.

How the flow works

  1. The Text-Compose card creates the request body as a URL-encoded string: title=Automation&subject=A book about automation&test=yes.
  2. The Flow Control-Assign card sets the request URL to https://postman-echo.com/post and the headers to
    {"Content-Type": "application/x-www-form-urlencoded"}.
  3. The API Connector-Post card sends a POST request using the URL and headers from the Flow Control-Assign card and the body from the Text-Compose card.

Output

When you run the flow and make a request to the Postman API, Postman returns (echoes) the data it received. The API Connector-Post card Body field returns the following:

JSON
{
"args": {},
"data": "",
"files": {},
"form": {
"title": "Automation",
"subject": "A book about automation",
"test": "yes"
},
"headers": {
"host": "postman-echo.com",
"content-length": "57",
"user-agent": "Azuqua",
"content-type": "application/x-www-form-urlencoded",
"x-forwarded-proto": "https",
"accept-encoding": "gzip, br"
},
"json": {
"title": "Automation",
"subject": "A book about automation",
"test": "yes"
},
"url": "https://postman-echo.com/post"
}
  • The form object shows the parsed body parameters (title, subject, test) — this is where Postman Echo puts URL-encoded body data, unlike the JSON example, where it showed up in data.
  • The content-type header confirms that the request was sent as application/x-www-form-urlencoded.
  • The args object is empty since this flow doesn’t send any query parameters.

Download the flow

Okta Workflows resources

Leave a Reply

Discover more from Max Katz

Subscribe now to keep reading and get access to the full archive.

Continue reading