requestExtensionData

Updated:

Make requests to your backing extension.

Description

Makes a request to the extension's backend data service. This is the primary way for extensions to communicate with their server-side logic.

Signature

tecton.sources.requestExtensionData(requestOptions: ExtensionRequestBody): Promise<ExtensionResponse<R>>;
export interface ExtensionRequestBody {
    route: string;
    body?: Record<string, any>;
    featureName?: string;
}
export interface ExtensionResponse {
    data: any;
    status: number;
    statusText: string;
}

Usage

Make a request to create a new user via the extension backend.

tecton.sources.requestExtensionData({
    route: 'create_user',
    body: { name: "Tecton", email: "tecton@q2.com" }
}).then((ExtensionResponse) => {
    // Do something with response
}).catch((ExtensionResponse) => {
    // Fires for non 200 series responses
});

Additional Information

When using the requestExtensionData source, there are important details to keep in mind.

Request Body Type

The body parameter must be a plain object (Record<string, any>). Do not pre-serialize it with JSON.stringify before passing it to requestExtensionData — the SDK handles serialization internally.

// Correct
tecton.sources.requestExtensionData({
    route: 'my_route',
    body: { key: 'value' }
});

// Incorrect - do not serialize body beforehand
tecton.sources.requestExtensionData({
    route: 'my_route',
    body: JSON.stringify({ key: 'value' })
});

In versions 1.52.0 through 1.65.0, passing a pre-serialized string as body would result in incorrect behavior. The SDK was later updated to automatically detect and parse string bodies, though Record<string, any> remains the expected type.

Parameters

Some parameters are only supported by specific platforms. Platform support for individual parameters will be indicated with a badge below the parameter name.

requestOptions.route
requestOptions.body
requestOptions.featureName
UUX

Release Notes

Tecton
0.16.0
Tecton
1.52.0
Tecton
1.66.0

Platform Support

UUX
Config
Console