Make requests to your backing extension.
Makes a request to the extension's backend data service. This is the primary way for extensions to communicate with their server-side logic.
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;
}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
});When using the requestExtensionData source, there are important details to keep in mind.
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.
Some parameters are only supported by specific platforms. Platform support for individual parameters will be indicated with a badge below the parameter name.
requestOptions.routerequestOptions.bodyrequestOptions.featureName