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.
- API Connector Raw Request card methods
- API Connector POST card
- API Connector PUT card
application/json
This content type expects a JSON object:
{"title": "This is the title","body":"This is the body"}
Use the Object Construct card to create a JSON object:
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:
text/xmlorapplication/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:
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.
