POST

Replace Data Item References


Replaces references in a specified field of a specified data item.

This method replaces the existing reference or references contained in the field specified in referringItemFieldName within the data item specified in referringItemId. The method removes existing references and in their place it adds references to the items specified in newReferencedItemIds.

Note: If you pass an empty array in newReferencedItemIds, all existing references are removed.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage All Data Resources
Manage Data Items
Write Data Items
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/wix-data/v2/items/replace-references

Body Params
dataCollectionIdstringRequiredmaxLength 256

ID of the collection containing the referring item.


referringItemFieldNamestringRequiredmaxLength 1000

Field containing references in the referring item.


referringItemIdstringRequiredmaxLength 128

ID of the referring item.


newReferencedItemIdsArray <string>maxLength 128maxItems 1000

List of new referenced item IDs to replace the existing ones.

Response Object
dataItemReferencesArray <DataItemReference>

Updated references.

Replace existing references with new references
Request
cURL
Response
JSON
Errors

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

Did this help?