Adds multiple items to a collection.
When each item is inserted into a collection, its ID is automatically assigned a random value. You can optionally provide your own ID when inserting the item. If you specify an ID that already exists in the collection, the insertion will fail.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the collection in which to insert the items.
Data items to insert.
Whether to return the inserted data items.
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
.Information about the inserted items.
Bulk action metadata.
curl -X POST \
'https://www.wixapis.com/wix-data/v2/bulk/items/insert' \
-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.