Update Collection
PATCH/api/v1/assetcollection/:collection_id
Update a Collection with partial data. At least one of name, description, group_access, additions, deletions, or source_id must be provided.
Note: The default Basket collection (
SELECTED_ASSETS) cannot have its name, description, or group access updated.
REQUEST PARAMETERS
| Parameter | Type | Description |
|---|---|---|
name | string | (optional) New collection name |
description | string | (optional) New collection description |
group_access | boolean | (optional) true to share with group, false for private |
additions | array | (optional) List of asset IDs to add to the collection |
deletions | array | (optional) List of asset IDs to remove from the collection |
source_id | integer | (optional) Collection ID whose assets will be merged into additions |
expected_revision | integer | (optional) The collection's revision as you read it. If it changed since, the update is refused with 409 and nothing is written |
REQUEST JSON
{
"name": "Updated Collection Name",
"description": "New description",
"group_access": true,
"additions": ["b3ad7854e1ad4ce8a8c83272447f980b"],
"deletions": ["caf2b5f2e80a40729e32489ee65ef0d8"],
"expected_revision": 7
}
Refusing stale writes
Send expected_revision with the revision you read from Get Collection. If the collection changed since, nothing is written and the response is 409 with "error": "stale_revision" and the collection's current_revision: read it again, re-apply your change and retry. A successful update returns the collection with its new revision, so you can chain another checked update without reading it again.
Without expected_revision the update is applied as before. expected_revision needs a single collection ID in the URL: a batch update of several collections (ids) cannot carry it and is refused with 400. See Retries and conflicts.
HTTP RESPONSE
| Parameter | Type | Description |
|---|---|---|
status | string | OK or ERROR |
data | JSON | Collection in Asset Collection JSON format |
Response JSON
{
"status": "OK",
"data": {
"id": 21,
"user_id": 45,
"name": "Updated Collection Name",
"description": "New description",
"last_update": "2025-01-24T09:11:05Z",
"assets": ["b3ad7854e1ad4ce8a8c83272447f980b"],
"group_access": true,
"user_name": "John Doe",
"user_email": "john@example.org",
"revision": 8,
"extended_result": {}
}
}
Request
Responses
- 200
- 400
- 401
- 403
- 409
- 500
Successful operation
Bad request - Invalid inputs, an expected_revision that is not a non-negative whole number, or expected_revision sent without a single collection ID in the URL
Unauthorized - Invalid or missing authentication
Forbidden - Insufficient permissions
expected_revision does not match: the collection changed since you read it. Nothing was written.
Internal server error