Warning: Wix Data APIs currently require the site's code editor to be enabled manually. For this reason, we recommend against using these APIs for developing Wix CLI apps and self-hosted apps.
The External Database Connections API enables you to connect an external database to a Wix site.
Wix provides a comprehensive full-stack platform with integrated database capabilities. However, certain projects may have specific requirements that make it necessary to use an external database. For example, you might need to access data that is already stored on an external service, or you might need the data to be stored in a relational database. The External Database Connections API allows you to create and manage the connection between the site and the external database.
Once the connection is established, you can access the external collection using Wix Data APIs in the same way you would with a native collection. You can use the Data Collections API to create, modify, and delete data collections. Similarly, you can use the Data Items API to access and manage data within those collections. The external collection can also be accessed through the Content Management System (CMS) or with site code, connected to user input elements, or used to create dynamic pages.
It's important to note the following points before starting to code:
To establish a connection between a site and an external database, you must prepare an external database adaptor.
To enable read-write access to the external database using the Data Items API, make sure the external database's table or schema includes the following fields:
_id
_createdDate
_updatedDate
_owner
If these fields are absent, access to the external database is read-only.
To establish a connection between a site and an external database, prepare an external database adaptor.
An external database adaptor is a server that translates data requests from a Wix site or app into the external database's protocol, and translates the response back into a format that Wix APIs can read. This enables Wix APIs, apps, and sites to treat the external database as if it were an internal data collection.
You can prepare an external database adaptor in one of the following ways: