Skip to main content
Skip table of contents

returnHTTPResponse

This command is deprecated and doesn’t work with Task or Batch API.

Defines the output of a composing process initiated through the Dynamo API. This command causes the API to produce a HTTP response with resolved values of code and message attributes as the response's code and content, respectively. Additionally, the current Step of the Flow ends, leaving any commands following returnHTTPResponse unevaluated. As this command ends the Step without specifying a next Step, it also finishes the current Segment.

As the Dynamo API only handles Flow-based templates, this command does nothing in Controller-based templates besides ending the current event handler.

Attributes

code

Required

Value type

EL-evaluated

Yes

Number, String

Yes

Defines the status code of the returned HTTP response. The resolved value is expected to a Number, or a String that can be parsed into a number. 

message

Required

Value type

EL-evaluated

No

String

Yes

Defines the message of the returned HTTP response. The resolved value is expected to be a String, but if it's of any other type, it will be converted into a String.If not defined, the response's message is blank. 

Examples

Use the returnHTTPResponse command to have the Dynamo API respond with something else besides the API's standard responses. Note that the code attribute allows basically any number to set as the response's code - it doesn't have to be any of the standard HTTP status codes:

CODE
<returnHTTPResponse code="7777777" message="Jackpot!">

If placed into a Step that is on the error route from some other Step, this command can be used to return a custom response containing some error information:    

CODE
<returnHTTPResponse code="400" message="Command '${error.commandName}' error: ${error.message}">
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.