POST

Bulk Insert Data Item References


Inserts one or more references in the specified fields of items in a collection.

This endpoint adds one or more references to a collection. Each new reference in the dataItemReferences field specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.

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/bulk/items/insert-references

Body Params
dataCollectionIdstringRequired

ID of the collection containing the referring items.


dataItemReferencesArray <DataItemReference>Required

References to insert.


returnEntityboolean

Whether to return the inserted data item references. When true, the results objects contain a dataItemReference field.

Default: false

Response Object
resultsArray <BulkDataItemReferenceResult>

Information about the inserted references.


bulkActionMetadataBulkActionMetadata

Bulk action metadata.

Request
cURL
curl -X POST \ 'https://www.wixapis.com/wix-data/v2/bulk/items/insert-references' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>' \ -d '{ "dataCollectionId": "albums", "dataItemReferences": [ { "referringItemFieldName": "songs", "referringItemId": "37de298e-026d-4b2e-b87f-fbec11d53105", "referencedItemId": "aafeaaf4-6192-4cc2-a79b-97ce0f1b3646" }, { "referringItemFieldName": "songs", "referringItemId": "37de298e-026d-4b2e-b87f-fbec11d53105", "referencedItemId": "e7fe3827-5102-470a-a10a-b6221dd0b4a9" } ] }'
Response
JSON
{ "results": [ { "action": "INSERT", "referenceMetadata": { "originalIndex": 0, "success": true } }, { "action": "INSERT", "referenceMetadata": { "originalIndex": 1, "success": true } } ], "bulkActionMetadata": { "totalSuccesses": 2, "totalFailures": 0 } }
Errors

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

Did this help?