Blogs
A blog is a collection of posts that are typically themed around the blog topic. Readers can follow a blog and become notified when new posts are generated.
Available Actions
Action | Route | Description |
---|---|---|
List | GET /api/blogs | Get a list of all blogs |
Get | GET /api/blogs/{blogId} | Retrieve details of a specific blog |
Create | POST /api/blogs | Create a new blog |
Update | PUT /api/blogs/{blogId} | Update an existing blog's details |
Delete | DELETE /api/blogs/{blogId} | Delete a specific blog |
List Blogs
Route: GET /api/blogs
Returns a paginated list of all blogs. No request parameters needed.
Example response:
{
"current_page": 1,
"data": [
{
"id": "99916745-06ce-45e3-a8d3-b920ae8d5060",
"slug": "sample-slug",
"title": "Sample Blog",
"description": "A detailed description goes here",
"banner": "[some image url]",
"created_at": "2023-07-04T19:10:18.000000Z",
"updated_at": "2023-07-04T19:10:18.000000Z"
}
],
// Rest of the pagination metadata
}
Get a Blog
Route: GET /api/blogs/{blogId}
Retrieves the details of a specific blog. Required path parameter: blogId
Example response:
{
"id": "99916745-06ce-45e3-a8d3-b920ae8d5060",
"slug": "sample-slug",
"title": "Sample Blog",
"description": "A detailed description goes here",
"banner": "[some image url]",
"created_at": "2023-07-04T19:10:18.000000Z",
"updated_at": "2023-07-04T19:10:18.000000Z"
}
Create a Blog
Route: POST /api/blogs
Creates a new blog.
Request body:
{
"slug": "string|required",
"title": "string|required",
"description": "string|optional",
"banner": "string|optional",
}
The response will be the same as the "Get a Blog" action.
Update a Blog
Route: PUT /api/blogs/{blogId}
Updates an existing blog's details. Required path parameter: blogId
Request body:
{
"slug": "string|optional",
"title": "string|optional",
"description": "string|optional",
"banner": "string|optional",
}
The response will be the same as the "Get a Blog" action.
Delete a Blog
Route: DELETE /api/blogs/{blogId}
Deletes a specific blog. Required path parameter: blogId
. There is no request body.
Example response:
{
"message": "Delete successful."
}
Share post: