Inserts or updates multiple items in a collection.
The Bulk Save Data Items method inserts or updates each item provided, depending on whether it already exists in the collection. For each item:
If you don't provide an ID, a new item is created.
If you provide an ID that doesn't exist in the collection, a new item is created with that ID.
If an item with the ID you provide already exists in the collection, that item is updated. When an item is updated, its data._updatedDate
field is changed to the current date and time.
Note: When you provide an item with an ID that already exists in the collection, the item you provide completely replaces the existing item with that ID. This means that all of the item's previous fields and values are lost.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the collection in which to insert or update the items.
Data items to insert or update.
Whether to return the saved data item.
When true
, the results
objects contain a dataItem
field.
Default: false
Additional parameters specific to the Wix app collection you are querying.
When querying the Wix Stores Products collection, pass the following optional parameters:
includeHiddenProducts
: Whether to include hidden products in the response. Default: false
.includeVariants
: Whether to include product variants in the query. Default: false
.Options for the Publish plugin. This plugin allows items in a data collection to be marked as draft or published. Published items are visible to site visitors, while draft items are not.
Information about the saved items.
Bulk action metadata.
curl -X POST \
'https://www.wixapis.com/wix-data/v2/bulk/items/save' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
"dataCollectionId": "cities",
"dataItems": [
{
"data": {
"state": "California",
"year": 2022,
"city": "Los Angeles",
"population": 3800000
}
},
{
"data": {
"state": "California",
"year": 2022,
"city": "San Francisco",
"population": 840000
}
}
]
}'
{
"results": [
{
"action": "INSERT",
"itemMetadata": {
"id": "aa019290-b546-4b3e-b302-8f6474baedf9",
"originalIndex": 0,
"success": true
}
},
{
"action": "INSERT",
"itemMetadata": {
"id": "39cbd938-7b42-4e33-8acf-ff1ce278664c",
"originalIndex": 1,
"success": true
}
}
],
"bulkActionMetadata": {
"totalSuccesses": 2,
"totalFailures": 0
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.