Return Raw
This function card returns data to the caller. This is an advanced version of the Return function card, but gives you full control over the HTTP response.
With this function card, you can do the following:
Produce an API that returns XML |
|
Produce an API that returns a JSON list |
|
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. Instead, the Return Raw function card enables you to use the Object function cards to build a response object, for example:
|
Set the HTTP status code for the response |
The Return function card always returns a 200 HTTP response code. You can use the Return Raw card to set the HTTP status code to any valid values, for example, 200 or from 400 through 599. |
Set the HTTP headers of the response |
Use the Object function cards to create an object representing any HTTP header that you need. For example, if the headers 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 |
A status code to return to the caller. Valid values are 200 or any other 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. |
Text |
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.