listExternalDatabaseConnections( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of all external database collections associated with the site or project.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage External Database Connections
Learn more about app permissions.
Method Declaration
Copy
function listExternalDatabaseConnections(
  options: ListExternalDatabaseConnectionsOptions,
): Promise<ListExternalDatabaseConnectionsResponse>;
Method Parameters
optionsListExternalDatabaseConnectionsOptions
Returns
Return Type:Promise<ListExternalDatabaseConnectionsResponse>
JavaScript
import { externalDatabaseConnections } from "wix-data.v2"; import { elevate } from "wix-auth"; const elevatedListExternalDbConnections = elevate( externalDatabaseConnections.listExternalDatabaseConnections, ); export async function myListExternalDatabaseConnectionsFunction() { try { const listExternalDbConnectionsResponse = await elevatedListExternalDbConnections(); const firstConnectionName = listExternalDbConnectionsResponse.externalDatabaseConnections[0].name; const firstConnectionHaveCollections = listExternalDbConnectionsResponse.externalDatabaseConnections[0] .connectionStatus.hasCollections; console.log( "Here is a list of all current external database connections: ", listExternalDbConnectionsResponse.externalDatabaseConnections, ); return listExternalDbConnectionsResponse; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * [ * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "fkapmf9s-kf5z-lg04-mfia-kfo294pamvi5" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connection1", * "protocolVersion": "V2", * }, * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "ukapguvn-kf5z-kfo4-kg94-nfoem4pamfi6" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connectionFour", * "protocolVersion": "V2", * }, * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "kf0pguvn-mgoi-kfo4-kg94-nfoefds5mfi6" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connectionThree", * "protocolVersion": "V2", * }, * { * "capabilities": { * "collectionModificationsSupported": false, * "fieldTypes": [] * } * "configuration": { * "secretKey": "fergfy84-kf5z-fdsf-kg94-nfoegfdg67i6" * }, * "connectionStatus": { * "successful": true, * "causeOfFailure": "NONE", * "hasCollections": "YES" * }, * "endpoint": "https://example.com/my-external-database", * "name": "connectionTwo", * "protocolVersion": "V2", * }, * { * "applicationId": "8b7e9a62-t5hd-4372-gres-c6fb7762600b" * "connectionStatus": { * "successful": false, * "causeOfFailure": "DESTINATION_ENDPOINT_NOT_DEFINED", * "hasCollections": "UNKNOWN" * }, * "name": "extDbSpi", * "protocolVersion": "V3", * } * ] */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?