<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

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

Okta Classic Engine
Okta Identity Engine
Workflows

Overview

Okta Workflows can combine values from earlier cards into request URLs, query parameters, headers, and request bodies for API calls. GET requests use the URL, query parameters, and headers, while POST requests can send either a JSON or a URL-encoded body. The returned response shows where each value appears after the request runs. This article will use the Postman Echo API for demonstration.

 

Solution

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 does not include a body.


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:

{
  "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 URLqueryheaders, and body fields for the request.

POST request.

 

How the flow works

  1. The Text-Compose card creates the request URLhttps://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 bodyheaders, 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:

{
  "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:

{
  "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 (titlesubjecttest) — 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

 

Related References

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