<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 Format the Body of an API Request Based on Content Type when Using the Okta Workflows API Connector

Workflows
Okta Classic Engine
Okta Identity Engine

Overview

When using the Workflows API Connector Raw Request card with the POST, PUT, PATCH, or DELETE methods, the request body must be properly formatted based on the Content Type expected by the API being called. Refer to the documentation of the service being called to determine the expected Content Type and structure of the body for a specific API.

 

The workflow examples below use the JSONPlaceholder free fake API to illustrate how to format the request body and headers for application/json and application/x-www-form-urlencoded content types. The SOAP example uses a public SOAP web service to illustrate how to format the request body and headers for text/xml or application/xml content types.

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Workflows
  • API Connector Raw Request card methods
  • API Connector POST card
  • API Connector PUT card

Solution

Format for the content type, JSON.

This content type expects a JSON object:

{
"title": "This is the title",
"body":"This is the body"
}

Create a JSON object containing the title and body parameters using the Object Construct card as shown in the following image.

Object Construct card

 

 

Format for the content type, application/x-www-form-urlencoded.

This content type expects a query string of name/value pairs separated by the ampersand character (&):

title=This is the title&body=This is the body

 

Use the Compose card to create the query string:

Compose card

 

 

Format for the content type, text/xml or application/xml.

These content types are typically used with SOAP web services that expect XML:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">;
<soap12:Body>
<CountryName xmlns="http://www.oorsprong.org/websamples.countryinfo">;
<sCountryISOCode>country</sCountryISOCode>
</CountryName>
</soap12:Body>
</soap12:Envelope>

This example uses a public SOAP web service that includes the ISO country code in the POST body and returns the country name. Use the Compose card to create the XML body:Compose card creating the XML body 

 

Format for the content type, multipart/form-data.

This content type is typically used to upload binary data, like the contents of a file, in the POST body. To upload files using Workflows, use the File Multipart Upload card rather than the API Connector.  For additional details regarding how to work with files in Okta Workflows, see Working with Files in Okta Workflows.

 

Related References

Loading
How to Format the Body of an API Request Based on Content Type when Using the Okta Workflows API Connector | Okta Support