Skip to main content

How to publish

The endpoints.publish object literal in the launch template can be used to configure where data is published:

Example: Publish HTTP configuration
{
"endpoints": {
"publish": {
"http": {
"url": "https://example.com/publish",
"method": "POST"
}
}
}
}

When adding this configuration a publish button will appear in the top right corner:

Publish button

When the user presses this button an HTTP POST request will be sent to https://example.com/publish. For more details about the format, read the publish output format reference documentation.

info

When receiving the publish request we recommend that you process the data asynchronously when responding to the request to avoid making the user having to wait for potential processing.

The application expects an HTTP response with a 2XX status code to indicate that everything went OK:

HTTP Response
HTTP/1.1 200 OK

and will result in the following message for the user:

Publish success

In case of error the application expects a 4XX HTTP status code with an optional error message in the body. You can choose to either just return a simple error message as plain text or a more detailed error message as JSON:

Plain Text Error Response

HTTP Response
HTTP/1.1 400 Bad Request
Content-Type: text/plain

this is an error message

This response would display like this in the application:

Publish failed with plain text error

JSON Error Response

HTTP Response
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
"message": "my message",
"detail": "this is a bit more details"
}

This response would display like this in the application:

Publish failed with JSON error