API

API Triggers expose a pipeline to the REST Data Server. For examples on how this works, see the REST Data Server page. API Triggers support parameters, allowing you to scope what can be sent to the pipeline.

Configuration

API Trigger

Enabled

The API Trigger must be enabled for it to be visible to the REST Data Server.

Parameters

Parameters allow users to define the expected payload structure that a pipeline can accept over the API. Each parameter includes a name, type, and optional default value. When parameters are defined, incoming requests must include a JSON payload that matches this structure. Parameters without default values must be explicitly provided in the payload. If the payload doesn’t match the defined parameters, the trigger fails the request.

If no parameters are defined, the pipeline will accept all incoming payloads. Requests that are of JSON content types will be treated as JSON values, while non-JSON content types will be treated as string values.

Custom Pipeline Behavior

Overriding Default HTTP Status Codes

By default, requests handled by the REST Data Server return predefined status codes with the generated HTTP responses. To override these, users can use pipeline metadata to specify a custom status code. To leverage status code overrides, the pipeline must produce a valid response using the Return Stage without completing in an error state.

Set the HTTPResponse.statusCode key to your desired status code. For example, to return a 202 Accepted response:

{javascript}
stage.setMetadata(
    "HTTPResponse",
    {
        "statusCode": 202
    }
);