Update collection
Description
Update an existing collection.
Url
1 |
PUT /api/v0/collection/UUID/ |
Parameters
optional
- uuid: collection's unique identifier
Example
Rename the collection identified by
14776d3099d2434b962b09b22680c408 to
My wine bottles
Request
1 2 3 4 |
curl -X PUT \ -H "Content-Type: application/json" \ 'https://my.craftar.net/api/v0/collection/14776d3099d2434b962b09b22680c408/?api_key=123456789abcdefghijk123456789abcdefghijk' \ -d '{"name": "My wine bottles" }' |
Response
HTTP Status code: 200 OK
1 2 3 4 5 |
{ "uuid": "14776d3099d2434b962b09b22680c408", "resource_uri": "/api/v0/collection/14776d3099d2434b962b09b22680c408/", "name": "My wine bottles" } |
Errors
HTTP Status code: 400 Bad Request
Invalid JSON
1 2 3 4 5 6 |
{ "error": { "message": "The content is not a valid JSON document.", "code": "INVALID_JSON" } } |
Content not in JSON
1 2 3 4 5 6 |
{ "error": { "message": "Expected application/json content but got application/xml.", "code": "WRONG_CONTENT_TYPE" } } |
Duplicate collection name
1 2 3 4 5 6 7 8 9 |
{ "error": { "code": "VALIDATION_ERROR", "message": "Some of the provided fields couldn't be validated. See the 'details' key for more information.", "details": { "name": ["Collection name must be unique"] } } } |
Empty collection name
1 2 3 4 5 6 7 8 9 |
{ "error": { "code": "VALIDATION_ERROR", "message": "Some of the provided fields couldn't be validated. See the 'details' key for more information.", "details": { "name": ["This field is required."] } } } |
HTTP Status code: 404 Not Found
Collection not found