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?

listCollections( )


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


Retrieves a list of data collections and their details.

When collectionIds is empty, all existing collections are returned. If a specified collection does not exist, that collection can be ignored.

Method Declaration
Copy
function listCollections(
  payload: ListCollectionsEnvelope,
): ListCollectionsResponse | Promise<ListCollectionsResponse>;
Method Parameters
payloadListCollectionsEnvelope
Returns
Return Type:ListCollectionsResponse | Promise<ListCollectionsResponse>
Example of a `collections` return value
JavaScript
import { externalDatabase } from "@wix/data/service-plugins"; externalDatabase.provideHandlers({ listCollections: 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: collections: [ { id: "cities", displayName: "Cities", fields: [ { key: "_id", displayName: "ID", description: "The ID of the document", type: "TEXT", capabilities: { sortable: true, queryOperators: ["EQ", "LT", "GT", "LTE", "GTE"], }, encrypted: false, }, { key: "name", displayName: "Name", description: "The name of the city", type: "TEXT", capabilities: { sortable: true, queryOperators: ["EQ", "STARTS_WITH"], }, encrypted: false, }, { key: "country", displayName: "Country", description: "Country code", type: "TEXT", capabilities: { sortable: true, queryOperators: ["EQ"], }, encrypted: false, }, { key: "pointsOfInterest", displayName: "Points of interest", type: "MULTI_REFERENCE", multiReferenceOptions: { referencedCollectionId: "pointsOfInterest", }, encrypted: false, }, { key: "_createdDate", displayName: "Created date", description: "The date when the document was created", type: "DATETIME", capabilities: { sortable: false, queryOperators: [], }, encrypted: false, }, { key: "_updatedDate", displayName: "Updated date", description: "The date when the document was last updated", type: "DATETIME", capabilities: { sortable: false, queryOperators: [], }, encrypted: false, }, ], capabilities: { dataOperations: ["QUERY", "COUNT"], }, permissions: { insert: "ADMIN", update: "ADMIN", remove: "ADMIN", read: "ANYONE", }, pagingMode: "OFFSET", }, { id: "pointsOfInterest", displayName: "Points of interest", fields: [ { key: "_id", displayName: "ID", description: "The ID of the document", type: "TEXT", capabilities: { sortable: true, queryOperators: ["EQ", "LT", "GT", "LTE", "GTE"], }, encrypted: false, }, { key: "name", displayName: "Name", description: "The name of the city", type: "TEXT", encrypted: false, }, ], capabilities: { dataOperations: ["QUERY", "COUNT"], }, permissions: { insert: "ADMIN", update: "ADMIN", remove: "ADMIN", read: "ANYONE", }, pagingMode: "OFFSET", }, ], }; }, });
Did this help?