Return Raw
This function card returns data to the caller. This function is an advanced version of Return. 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 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, then use 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 will always return 200. Use the Return Raw card 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 a 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". Workflows will merge 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, 400-600. | Number | FALSE |
headers | An object representing the headers for the response. Each key of the header will be parsed into a header string as "key: value"; that is, "Content-Type: text/plain". | Object | FALSE |
body | HTTP response body. | String | FALSE |
Output
This card has no output fields.