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?

aggregateDataItems( )


Important:


Runs an aggregation query on the specified data collection and returns the resulting list of items.

Method Declaration
Copy
Method Parameters
payloadAggregateDataItemsEnvelope
Returns
Return Type:AggregateDataItemsResponse | Promise<AggregateDataItemsResponse>
Example of `items` and `pagingMetadata` return values
JavaScript
Did this help?

countDataItems( )


Important:


Counts the number of items in the specified data collection that match the filtering preferences.

Method Declaration
Copy
Method Parameters
payloadCountDataItemsEnvelope
Returns
Return Type:CountDataItemsResponse | Promise<CountDataItemsResponse>
Example of a `totalCount` return value
JavaScript
Did this help?

createCollection( )


Important:


Creates a new data collection.

Method Declaration
Copy
Method Parameters
payloadCreateCollectionEnvelope
Returns
Return Type:CreateCollectionResponse | Promise<CreateCollectionResponse>
Example of a `collection` return value
JavaScript
Did this help?

deleteCollection( )


Important:


Deletes a data collection.

Method Declaration
Copy
Method Parameters
payloadDeleteCollectionEnvelope
Returns
Return Type:DeleteCollectionResponse | Promise<DeleteCollectionResponse>
Example of a delete collection handler
JavaScript
Did this help?

getCapabilities( )


Important:


Lists the global capabilities the external database supports.

Method Declaration
Copy
Method Parameters
payloadGetCapabilitiesEnvelope
Returns
Return Type:GetCapabilitiesResponse | Promise<GetCapabilitiesResponse>
Example of `supportsCollectionModifications` and `supportedFieldTypes` return values
JavaScript
Did this help?

insertDataItemReferences( )


Important:


Inserts one or more item references into a referring field of the specified item.

Method Declaration
Copy
Method Parameters
payloadInsertDataItemReferencesEnvelope
Returns
Return Type:InsertDataItemReferencesResponse | Promise<InsertDataItemReferencesResponse>
Example of a `results` return value
JavaScript
Did this help?

insertDataItems( )


Important:


Adds one or more items to a collection.

A data item object contains the _id and _owner fields. The response array must include the same items that were inserted, and each returned item must be added the _createdDate and _updatedDate fields.

However, data items can also be inserted without an _id field. In that case, it is the service provider's responsibility to generate a unique ID for each item.

Method Declaration
Copy
Method Parameters
payloadInsertDataItemsEnvelope
Returns
Return Type:InsertDataItemsResponse | Promise<InsertDataItemsResponse>
Example of a `results` return value
JavaScript
Did this help?

listCollections( )


Important:


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
Method Parameters
payloadListCollectionsEnvelope
Returns
Return Type:ListCollectionsResponse | Promise<ListCollectionsResponse>
Example of a `collections` return value
JavaScript
Did this help?