API

We provide an API to allow programmatic updating of one’s blog.

API Key
your-api-key

Notes


Authentication

We authenticate requests using the Authorization HTTP header, using the Bearer scheme.

Authorization: Bearer your-api-key

POST /api/posts/

Create new post.

Parameters Request
{
    "title": "New blog",
    "body": "## Why?\n\nEveryone wants a blog, right?",
    "published_at": "2020-09-21"
}
Response
{
    "ok": true,
    "slug": "new-blog",
    "url": "https://your-username.mataroa.blog/blog/new-blog/"
}
curl
$ curl -X POST \
    -H 'Authorization: Bearer your-api-key' \
    -d '{"title": "New blog", "body": "## Why?\n\nEveryone needs a blog, right?"}' \
    https://mataroa.blog/api/posts/

GET /api/posts/<post-slug>/

Get single post.

Parameters Response
{
    "ok": true,
    "slug": "new-blog",
    "title": "New blog",
    "body": "Welcome!"
    "published_at": "2020-09-21"
    "url": "https://your-username.mataroa.blog/blog/new-blog/"
}
curl
$ curl -X GET \
    -H 'Authorization: Bearer your-api-key' \
    https://mataroa.blog/api/posts/new-blog/

PATCH /api/posts/<post-slug>/

Update existing post.

Parameters Request
{
    "title": "Updating my new blog",
    "slug": "updating-blog",
    "body": "Welcome back!"
    "published_at": "2020-09-21"
}
Response
{
    "ok": true,
    "slug": "updating-blog",
    "url": "https://your-username.mataroa.blog/blog/updating-blog/"
}
curl
$ curl -X PATCH \
    -H 'Authorization: Bearer your-api-key' \
    -d '{"title": "Updating my new blog", "body": "Rethinking and rewriting."}' \
    https://mataroa.blog/api/posts/introducing-my-new-blog/

DELETE /api/posts/<post-slug>/

Delete post.

Parameters Response
{
    "ok": true
}
curl
$ curl -X DELETE \
    -H 'Authorization: Bearer your-api-key' \
    https://mataroa.blog/api/posts/introducing-my-new-blog/

GET /api/posts/

List all posts.

Parameters Response
{
    "ok": true,
    "post_list": [
        {
            "title": "On life",
            "slug": "on-life",
            "body": "What is life?\n\nAn illusion, a shadow, a story.",
            "published_at": null,
            "url": "https://your-username.mataroa.blog/blog/on-life/"
        },
        {
            "title": "New blog",
            "slug": "new-blog",
            "body": "With health!",
            "published_at": "2020-10-19",
            "url": "https://your-username.mataroa.blog/blog/new-blog/"
        }
    ]
}
curl
$ curl -X GET \
    -H 'Authorization: Bearer your-api-key' \
    https://mataroa.blog/api/posts/