Skip to main content
Version: ACE 5

Response

Overview

When building Dynamic APIs it is necessary to respond with the different response codes to comply with the HTTP/REST protocol specification.

Response step allows to easily set API response's body, status, headers properties and others special properties like stopApiExecution, responseType in doc without need of remembering exact syntax to set these variables. It can be used to stop further execution of flow steps using continueFlowExecution property of this step.

Configuration

  • Body (optional) - it is used to set the response body of API, i.e, 'result' property of flow doc.
  • Status code (optional) - it is used to set the response status code of API, the 'responseStatusCode' property of doc.
  • Response headers (optional) - it is used to set the response headers of API, the 'responseHeaders' property of doc.
  • File response type - sets 'responseType' property in doc as file. If response type is file, then body must contain file reference and ACE API returns file for download.
  • Stop API execution - sets 'aceApiStopExecution' in doc which stops further API handler execution.
  • Continue flow execution - stops further execution of steps, in case of sub-flow only sub flow steps are stopped.

Sample step configuration

Sample step
    name: Step response
description: ""
config:
continueFlowExecution: false
stopApiExecution: false
responseTypeFile: false
stepType: response
condition: ""

Examples

ResponseFlow
      tags: []
sampleInputSchema: ""
sampleData: {}
description: ""
baseFlow: null
steps:
- name: Step response
description: ""
config:
continueFlowExecution: false
stopApiExecution: false
responseTypeFile: false
body:
responseBodyKey: responseBodyVal
statusCode: "200"
headers:
responseHeadersKey: responseHeadersVal
stepType: response
condition: ""

Input Document and Result

Input document
{}
Flow Result
{
"doc": {
"result": {
"responseBodyKey": "responseBodyVal"
},
"responseStatusCode": "200",
"responseHeaders": {
"responseHeadersKey": "responseHeadersVal"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "response",
"executionTime": 50
}
],
"executionTimeOfFlow": 50,
"timeMetric": "ms"
},
"files": []
}