Tags
Summary of tag endpoints
- GET /admin/api/tags - list all tags for the current site.
- GET /admin/api/tags/1 - get data for a single tag.
- PUT /admin/api/tags/1 - update attributes of a single tag.
- DELETE /admin/api/tags/1 - remove a tag.
List all tags for the current site
GET /admin/api/tags
By default, this requests returns a list of all tags for the current site.
This endpoint also allows anonymous access that return only a list of published articles. Articles under blog pages are not returned.
Example response (authenticated request):
Status: 200 OK
[
{
"id": 2,
"name": "art",
"created_at": "2014-01-31T13:43:36.000Z",
"updated_at": "2014-01-31T13:43:36.000Z",
"url": "http://helloworld.voog.co/admin/api/tags/2",
"language": {
"id": 40,
"code": "en",
"title": "ENG",
"created_at": "2014-01-22T09:19:04.000Z",
"updated_at": "2014-01-22T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/languages/40"
}
}, {
"id": 1,
"name": "fun",
"created_at": "2014-01-31T13:43:36.000Z",
"updated_at": "2014-01-31T13:43:36.000Z",
"url": "http://helloworld.voog.co/admin/api/tags/1",
"language": {
"id": 1,
"code": "en",
"title": "ENG",
"created_at": "2014-01-22T09:19:04.000Z",
"updated_at": "2014-01-22T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/languages/40"
}
}
]
Example response (anonymous request):
Status: 200 OK
[
{
"id": 2,
"name": "art",
"url": "http://helloworld.voog.co/admin/api/tags/2",
"language": {
"id": 40,
"code": "en",
"title": "ENG"
}
}, {
"id": 1,
"name": "fun",
"url": "http://helloworld.voog.co/admin/api/tags/1",
"language": {
"id": 1,
"code": "en",
"title": "ENG"
}
}
]
Parameters
per_page
- elements per response (default:50
; maximum:250
).page
- requested page (default:1
).language_id
- language id (eg?language_id=1
). Returns only tags for requested language.language_code
- language id (eg?language_code=en
). Returns only tags for requested language.
Filter attributes
Read more about filters.
- Object
tag
attributes:id
,language_id
,name
,created_at
,updated_at
. - Object
language
attributes:id
,code
,title
,position
,default_language
,created_at
,updated_at
.
Get data for a single tag
GET /admin/api/tags/1
Get detailed data for single tag.
This endpoint also allows anonymous access that return only published tagged objects. Tagged objects under private pages are not returned.
Example request:
GET http://helloworld.voog.co/admin/api/tags/1
Example response (authenticated request):
Status: 200 OK
{
"id": 1,
"name": "fun",
"created_at": "2014-01-31T13:43:36.000Z",
"updated_at": "2014-01-31T13:43:36.000Z",
"url": "http://helloworld.voog.co/admin/api/tags/1",
"language": {
"id": 1,
"code": "en",
"title": "ENG",
"created_at": "2014-01-22T09:19:04.000Z",
"updated_at": "2014-01-22T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/languages/40"
},
"taggings": [{
"id": 1,
"type": "article",
"title": "Having sample news pieces?"
"url": "http://helloworld.voog.co/admin/api/articles/1",
"public_url": "http://helloworld.voog.co/blog/having-sample-news-pieces"
}]
}
Example response (anonymous request):
Status: 200 OK
{
"id": 1,
"name": "fun",
"url": "http://helloworld.voog.co/admin/api/tags/1",
"language": {
"id": 1,
"code": "en",
"title": "ENG"
},
"taggings": [{
"id": 1,
"type": "article",
"title": "Having sample news pieces?"
"url": "http://helloworld.voog.co/admin/api/articles/1",
"public_url": "http://helloworld.voog.co/blog/having-sample-news-pieces"
}]
}
Update attributes of a single tag
PUT /admin/api/tags/1
Example request:
PUT http://helloworld.voog.co/admin/api/tags/1
Example data:
{
"name": "New Label!"
}
Example response:
Status: 200 OK
{
"id": 1,
"name": "New Label",
"created_at": "2014-01-31T13:43:36.000Z",
"updated_at": "2014-01-31T13:55:11.000Z",
"url": "http://helloworld.voog.co/admin/api/tags/1",
"language": {
"id": 1,
"code": "en",
"title": "ENG",
"created_at": "2014-01-22T09:19:04.000Z",
"updated_at": "2014-01-22T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/languages/40"
}
}
Parameters
Required parameters:
name
- unique label (case insensitive) for tag. Allowed charters are: unicode charters, numbers, ".", "-" and space (e.g."tõde ja õigus"
).
Remove a tag
DELETE /admin/api/tags/1
This request deletes the tag from the database.
Example request:
DELETE http://helloworld.voog.co/admin/api/tags/1
Example response:
Status: 204 No Content