Tags API
Content
Tags collection:
Single tag:
Tags collection
Create tag
POST /api/v0/tags
This method needs permission
createontags.
Method for creating new Tag.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | Name of tag | Required. |
POST /api/v0/tags HTTP/1.1
Content-Type: application/json
{
"name": "Backend"
}
Responses
201 CREATED
New Tag was successfully created.
POST /api/v0/tags HTTP/1.1
Content-Type: application/json
Status-Code: 201
{
"id": 1,
"name": "Backend",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/tags/1",
"rel": "self",
"type": "GET"
}
]
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
POST /api/v0/tags HTTP/1.1
Content-Type: application/json
Status-Code: 422
{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "984a545c-7019-45b4-ab37-3c95da1ed13e",
"errors": [
{
"field": "name",
"message": "This field is required."
}
]
}
Tags index
GET /api/v0/tags
Get list of existing Tags.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, name, created_at, updated_at |
| Filters | id:enum, name:string, created_at:date, updated_at:date |
| Embedded | - |
GET /api/v0/tags HTTP/1.1
Responses
200 OK
GET /api/v0/tags HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"items": [
{
"id": 1,
"name": "Backend",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/tags/1",
"rel": "self",
"type": "GET"
}
]
},
{
"id": 2,
"name": "Frontend",
"created_at": "2022-11-25T13:57:25+0100",
"updated_at": "2022-11-25T13:57:25+0100",
"_links": [
{
"href": "/api/v0/tags/2",
"rel": "self",
"type": "GET"
}
]
}
]
}
Single Tag
Tag detail
GET /api/v0/tags/{tag_id}
Get Tag detail.
Request
GET /api/v0/tags/1 HTTP/1.1
Responses
200 OK
GET /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"id": 1,
"name": "Backend",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/tags/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Tag was not found.
GET /api/v0/tags/10 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Update Tag
PUT/PATCH /api/v0/tags/{tag_id}
This method needs permission
updateontags.
Method for updating Tag data.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | bool | Name of tag | Required. |
For PATCH method any field can be omitted.
PUT /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
{
"name": "Shared",
}
Responses
200 OK
Tag successfully updated.
PUT /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"id": 1,
"name": "Shared",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/tags/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Tag was not found.
PUT /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
PUT /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
Status-Code: 422
{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "ad659bbb-608c-4cf9-8e5b-2b3078b25beb",
"errors": [
{
"field": "is_default",
"message": "Set another currency as default."
}
]
}
Delete tag
DELETE /api/v0/tags/{tag_id}
This method needs permission
deleteontags.
Method for deleting Tag.
Request
DELETE /api/v0/tags/1 HTTP/1.1
Responses
204 NO CONTENT
Tag successfully deleted.
DELETE /api/v0/tags/1 HTTP/1.1
Status-Code: 204
404 NOT FOUND
Tag was not found.
DELETE /api/v0/tags/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}