Extension Config


To configure and customize your service plugin, you need to provide important details in the plugin.json configuration file.

Note

If you created your service plugin extension with the CLI, required fields are automatically populated for you.

Configuration Params
namespacestring

The namespace of the external database. This can be used to access collections within the database, for example namespace/collectionId.


uriConfigSpiBaseUri

The URI where the service provider is deployed.

External Database Extension Config
JSON
{ "namespace": "@your-account-name/your-app-name", "uriConfig": { "baseUri": "https://my-external-database-app.com/", "alternativeUris": { "absoluteUri": "https://www.my-external-database-app.com/my-create-collection", "methodName": "CreateCollection" } } }
Did this help?

queryDataItems( )


Important: This is a handler function. Implement it only as part of the service plugin.


Retrieves a list of items based on the provided filtering, sorting, and paging preferences.

Method Declaration
Copy
function queryDataItems(
  payload: QueryDataItemsEnvelope,
): QueryDataItemsResponse | Promise<QueryDataItemsResponse>;
Method Parameters
payloadQueryDataItemsEnvelope
Returns
Return Type:QueryDataItemsResponse | Promise<QueryDataItemsResponse>
Example of `items` and `pagingMetadata` return values
JavaScript
import { externalDatabase } from "@wix/data/service-plugins"; externalDatabase.provideHandlers({ queryDataItems: async (payload) => { const { request, metadata } = payload; // Use the `request` and `metadata` received from Wix and // apply custom logic. return { // Return your response exactly as documented to integrate with Wix. // Return value example: items: [ { name: "New York", _id: "c285e77c-a86b-4361-a55f-c6b934d70187", population: 8300000.0, country: "US", isCapital: false, }, ], pagingMetadata: { total: 1, }, }; }, });
Errors
BadRequestWixErrorclass
CollectionAlreadyExistsWixErrorclass
CollectionChangeNotSupportedWixErrorclass
CollectionNotFoundWixErrorclass
ItemAlreadyExistsWixErrorclass
ItemNotFoundWixErrorclass
ReferenceAlreadyExistsWixErrorclass
ReferenceNotFoundWixErrorclass
ValidationWixErrorclass
Did this help?