Return Raw

This function card returns data to the caller. This function is an advanced version of the Return function. It allows for full control over the HTTP response.

With this function, you can do the following:

  • Produce an API that returns XML: Use the XML Build function card to create an XML string containing your response. Then drag the output to the body input of a Return Raw card.

  • Produce an API that returns a JSON list: Use the JSON Stringify function card to create a stringified representation of your list response. Then drag the output to the body input of the Return Raw card.

  • Produce an API that returns an object with dynamic keys: The Return function card requires you to define the keys of your response at design time. By using the Return Raw function card, you can use the Object functions to build a response object. Use the JSON Stringify card to create a stringified version of the object. Then drag the output to the body input of the Return Raw card.

  • Set the status code for the response: The Return function card always returns a 200 response code. Use the Return Raw card to set the status code to one of the valid values (200, or from 400 through 599).

  • Set the http headers of the response: Use the Object functions to create an object representing a header that you need. For example, if the header object is { "Content-Type": "application/xml" }, then the header string for the response is "Content-Type: application/xml". Okta Workflows merges those headers with the headers produced by the API service.

Input

Field Definition Type Required

statusCode

Status code to return to the caller.

Valid values are 200 or any HTTP response code from 400 through 599.

Number

FALSE

headers

An object representing the headers for the response.

Each key of the header is parse into a header string as a "key: value" entry. For example, "Content-Type: text/plain".

Object

FALSE

body

The body of the HTTP response.

String

FALSE

Output

This card has no output fields.

This function card behaves differently when placed inside a If/ElseIf or If/Error block.

Consider those blocks as representing anonymous helper flows. Similar to when you call a helper flow, this function card returns you to the parent. Placing this function card inside one of those block sends you to the step immediately after the container.

Use a Continue If function after the If/ElseIf block to stop a flow under normal conditions. You can use a Return Error or Return Error If card instead, but those options generate an error when the flow halts.

Related topics

Functions in Workflows

Workflow elements