Response
This is the official documentation of Forest Admin Cloud.
After executing an action, the UI will display a notification message based on the HTTP status code received.
To make the code easier to read, all the code snippets below should be wrapped in the following code. Ensure you update the collection and action names as needed.
Simple response
The resultBuilder
argument passed to the execution
function enables you to customize the response of an action.
HTML response
Additionally, you can return an HTML response to present richer content.
File response
You can also provide a downloadable file as a response to a triggered action.
To use this feature, you have to include generateFile: true
within the action's definition.
Inline content
Buffer content
Stream content
Making a redirection
You can redirect to another location after triggering an action.
Triggering a Webhook
Webhooks enable triggering actions in third-party applications or starting background tasks for users, using HTTP/HTTPS callbacks. Triggers occur in the user's browser, thus are subject to CORS restrictions.
Modifying HTTP Headers
It is possible to change the HTTP response headers by using the setHeader()
function.
After calling setHeader()
, you can call any response method previously described, such as:
It's important to understand that the webhook()
function and the setHeader()
function serve different purposes. The former sends headers with the webhook call, while the latter modifies the headers of the HTTP response. These operations do not interfere with each other.
Last updated