Return Raw

Returns data to the caller, with full control over the HTTP Response.  

This function is an advanced version of Return - it is less convenient to use but allows for full control over the HTTP Response.  

Using this function you can do the following:

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

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

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

  • Set the status code for the response:  Return will always return 200.  Use Return Raw to set the status code to one of the valid values (200, or 400-600).

  • Set the http headers of the response:  Use the Object functions to create an object representing your desired header.  For example if the headers object is { "Content-Type": "application/xml" } then the header string for the response would be "Content-Type: application/xml".  The designer will merge those headers with the headers produced by our API service.

Input Fields

  • statusCode(Number): the status code to return to the caller.  Valid values are:  200, 400-600.

  • headers (Object): An object representing the headers for the response.  Each key of the header will be parsed into a header string as "key: value", i.e. "Content-Type: text/plain"

  • body (Text): The http response body.

Output Fields

No output fields.

See Also

Functions in Workflows

About the elements of Okta Workflows