API Reference
Authentication
All requests need to be authenticated by sending an X-API-Key
header with the value of your API key (get yours from the API section in the Settings page). For example:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/posts
Pagination
All collection endpoints are paginated. They receive two parameters:
-
page
: The page to show results for. Defaults to1
. -
limit
: The maximum amount of results to return per request, between1
and50
. Defaults to50
.
Responses will include a pagination
object describing the results:
{
"data": [...],
"pagination": {
"page": 1,
"pages": 2,
"total": 69,
"limit": 50
}
}
Resources
Posts
Endpoints:
GET /v1/posts
GET /v1/posts/:id
Get a list of posts
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/posts
Response:
{
"data": [
{
"id": "855c13",
"slug": "example",
"url": "http://test.bloggi.co/example",
"published_at": "2019-11-15T22:04:08Z",
"created_at": "2019-11-15T19:28:21Z",
"updated_at": "2020-10-22T23:24:24Z",
"title": "Example",
"html": "<p>The content...</p>",
"excerpt": "The excerpt...",
"image_url": null,
"code_head": "",
"tags": [
{
"name": "A tag",
"slug": "a-tag"
}
]
}
],
"pagination": {
"page": 1,
"pages": 1,
"total": 1,
"limit": 50
}
}
Filtering by tag
You can specify a tag
parameter with the slug
of the tag you wish to filter by as the value. For example:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/posts?tag=changelog
Get a post
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/posts/:id
Where :id
can be either the id
or the slug
of the post (in the unlikely case of a conflict, it will be treated as an id
).
Response:
{
"data": {
"id": "855c13",
"slug": "example",
"url": "http://test.bloggi.co/example",
"published_at": "2019-11-15T22:04:08Z",
"created_at": "2019-11-15T19:28:21Z",
"updated_at": "2020-10-22T23:24:24Z",
"title": "Example",
"html": "<p>The content...</p>",
"excerpt": "The excerpt...",
"image_url": null,
"code_head": "",
"tags": [
{
"name": "A tag",
"slug": "a-tag"
}
]
}
}
Pages
Endpoints:
GET /v1/pages
GET /v1/pages/:id
Get a list of pages
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/pages
Response:
{
"data": [
{
"id": "855c13",
"slug": "example",
"url": "http://test.bloggi.co/example",
"published_at": "2019-11-15T22:04:08Z",
"created_at": "2019-11-15T19:28:21Z",
"updated_at": "2020-10-22T23:24:24Z",
"title": "Example",
"html": "<p>The content...</p>",
"excerpt": "The excerpt...",
"image_url": null,
"code_head": ""
}
],
"pagination": {
"page": 1,
"pages": 1,
"total": 1,
"limit": 50
}
}
Get a page
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/pages/:id
Where :id
can be either the id
or the slug
of the page (in the unlikely case of a conflict, it will be treated as an id
).
Response:
{
"data": {
"id": "855c13",
"slug": "example",
"url": "http://test.bloggi.co/example",
"published_at": "2019-11-15T22:04:08Z",
"created_at": "2019-11-15T19:28:21Z",
"updated_at": "2020-10-22T23:24:24Z",
"title": "Example",
"html": "<p>The content...</p>",
"excerpt": "The excerpt...",
"image_url": null,
"code_head": "",
}
}
Tags
Endpoints:
GET /v1/tags
GET /v1/tags/:id
Get a list of tags
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/tags
Response:
{
"data": [
{
"name": "Test",
"slug": "test",
"count": 1
}
],
"pagination": {
"page": 1,
"pages": 1,
"total": 1,
"limit": 50
}
}
Get a tag
Request:
curl -H "X-API-Key: YOUR_API_KEY" https://bloggi.co/api/v1/tags/:slug
Response:
{
"data": {
"name": "Test",
"slug": "test",
"count": 1
}
}