API result action
The API Gateway runs the API result action to prepare responses to the client based on the result from the API execute action.
About this task
The API result action examines whether the result of the
API execute action contains unhandled errors.
- If yes, the API result action prepares a JSON error object and
sends the object to the client as the response. The error object takes
the following format.
{ "name": <error name>, "message": <error message> } - If no, the API result action reads the API context and uses the
variables
message.body,message.headers,message.status.code, andmessage.status.reasonto compose the response to the client.
The API result action uses the variables in the destination context to prepare the final response to the client. The default value is OUTPUT, which indicates to transmit the context variables to the destination context. When the value is changed or removed, the context variables are not transmitted to the destination context, and, therefore, no response is returned to the client.
Procedure
- In the search field, enter api
- From the search results, click API Result Action.
- Click Add or New.
- Define the basic properties: Name, administrative state, and descriptive summary.
- Optional: Identify the destination context that receives variables from the API context.
- Click Apply to save the changes to the running configuration.
- Click Save Configuration or Save changes to save the changes to the persisted configuration.