About the Data Sharing Policy API

The Data Sharing Policy API enables collection sharing between multiple sites in the same Wix account. It allows for cross-site data collaboration while maintaining data integrity and collection permissions.

The Data Sharing Policy API supports a 2-sided workflow where you can:

  • Create and manage data sharing policies for sharing collections from a source site.
  • Connect to or disconnect from a sharing policy for accessing the shared collection on a target site.

Shared collections are accessed through the CMS and the Data Items APIs using the collection ID.

Real-time synchronization

  • Changes to shared data appear instantly across all connected sites. When you modify data items on the collection's source site or on a target site, the updates are immediately reflected everywhere.
  • When a data sharing policy is deleted from a source site, the shared collection is immediately removed from any target sites connected to the policy. This can cause code in target sites to break.

Working with Data APIs

  • Use the Data Items API to access, create, and update data items in the shared collections.
  • If you call List Shared Data Collections, all shared collections the site is connected to are included in the response.

Before you begin

It's important to note the following before starting to code:

  • Data collection sharing only works between sites in the same Wix account. You can't share collections with sites belonging to different Wix accounts.
  • External collections connected to a site and Wix App collections can't be shared.
  • When sharing a collection, the collection's permissions remain unchanged. This means if you share a collection, the target site inherits the collection's permissions as they exist in the source site.

Terminology

  • Data sharing policy: Defines which collection to share, optional filtering rules to restrict which items are shared, and serves as the access credential for other sites to connect to the shared collection.

  • Sharing or shared connection: The active link between a source site and target site that enables data access.

  • Source site: Site that owns the collection and creates and manages sharing policies for that collection.

  • Target site: Site that connects to and accesses the shared collection using the data sharing policy ID.

Did this help?