Updates an item in a collection.
This method replaces the data item's existing data with the payload provided in dataItem.data
in the request.
To update an item, you need to specify an item ID and a collection ID. If an item is found in the specified collection with the specified ID, that item is updated. If the collection doesn't contain an item with that ID, the request fails.
When an item is updated, its data._updatedDate
field is changed to the current date and time.
Note:
After an item is updated, it only contains the fields included in the dataItem.data
payload in Update Data Item request. If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
You can only call this method when authenticated as a Wix app or Wix user identity.
Data item ID.
ID of the collection containing the existing item.
Updated data item content. The existing data item's content is replaced entirely.
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.
Updated data item.
curl -X PUT \
'https://www.wixapis.com/wix-data/v2/items/5331fc15-9441-4fd4-bc7b-7f6870c69228' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
-d '{
"dataCollectionId": "cities",
"dataItem": {
"data": {
"state": "California",
"year": 2022,
"city": "Los Angeles",
"population": 3800000
}
}
}'
{
"dataItem": {
"id": "5331fc15-9441-4fd4-bc7b-7f6870c69228",
"dataCollectionId": "cities",
"data": {
"_id": "5331fc15-9441-4fd4-bc7b-7f6870c69228",
"_createdDate": { "$date": "2023-03-28T12:20:43.745Z" },
"_updatedDate": { "$date": "2023-03-28T12:20:43.745Z" },
"_owner": "690264f5-29a0-4aa8-a9b5-0842fc5ab360",
"state": "California",
"year": 2022.0,
"city": "Los Angeles",
"population": 3800000.0
}
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.