Create tag
Description
Create a new Tag in a given Collection. You should contact support to enable this feature int your account.
Url
1 |
POST /api/v0/tag/ |
Parameters
optional
- collection: resource uri like /v0/collection/UUID/
- name: unique name of your Tag
Example
Request
1 2 3 4 |
curl -X POST \ -H "Content-Type: application/json" \ 'https://my.craftar.net/api/v0/tag/?api_key=418a5ddd1810943e9e51f2238ffa0f3c8914639f' \ -d '{"name": "My_Tag", "collection": "/api/v0/collection/7d46f8baef92411b9539393f880b2b10/"}' |
Response
HTTP Status code: 201 Created
1 2 3 4 5 6 |
{ "collection": "/api/v0/collection/7d46f8baef92411b9539393f880b2b10/", "name": "My_Tag", "resource_uri": "/api/v0/tag/f0dc1ca3115040ae8a46fd1c946fe900/", "uuid": "f0dc1ca3115040ae8a46fd1c946fe900" } |
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 tag 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": { "__all__": ["Tag with this Name and Collection already exists."] } } } |
Empty tag 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: 403 Forbidden
Tags not enabled
1 2 3 4 5 6 |
{ "error": { "message": "Working with Tags requires upgrading your plan.", "code": "TAGS_NOT_ENABLED" } } |