Documentation0 followers

We know how to have our cake and eat it too. Our docs are built using our app.

Posts

A post is an article on a specific topic. Posts form the content base of a blog, with each typically focusing on a specific subject matter, idea, or theme.

Available Actions

Action Route Description
List GET /api/blogs/{blogId}/posts Get a list of all posts for a specific blog
Get GET /api/blogs/{blogId}/posts/{postId} Retrieve details of a specific post
Create POST /api/blogs/{blogId}/posts Create a new post for a specific blog
Update PUT /api/blogs/{blogId}/posts/{postId} Update an existing post's details
Delete DELETE /api/blogs/{blogId}/posts/{postId} Delete a specific post

List Posts

Route: GET /api/blogs/{blogId}/posts

Returns a paginated list of all posts for a specific blog. Required path parameter: blogId

Example response:

{
  "current_page": 1,
  "data": [
    {
      "id": "99916745-06ce-45e3-a8d3-b920ae8d5060",
      "author_id": "99916745-06ce-45e3-a8d3-b920ae8d5061",
      "slug": "sample-slug",
      "title": "Sample Post",
      "exerpt": "A brief summary of the post",
      "body": "The full content of the post",
      "feature_image": "[some image url]",
      "feature_image_caption": "An optional image caption",
      "created_at": "2023-07-04T19:10:18.000000Z",
      "updated_at": "2023-07-04T19:10:18.000000Z"
    }
  ],
  // Rest of the pagination metadata
}

Get a Post

Route: GET /api/blogs/{blogId}/posts/{postId}

Retrieves the details of a specific post. Required path parameters: blogId, postId

Example response:

{
  "id": "99916745-06ce-45e3-a8d3-b920ae8d5060",
  "author_id": "99916745-06ce-45e3-a8d3-b920ae8d5061",
  "slug": "sample-slug",
  "title": "Sample Post",
  "exerpt": "A brief summary of the post",
  "body": "The full content of the post",
  "feature_image": "[some image url]",
  "feature_image_caption": "An optional image caption",
  "created_at": "2023-07-04T19:10:18.000000Z",
  "updated_at": "2023-07-04T19:10:18.000000Z"
}

Create a Post

Route: POST /api/blogs/{blogId}/posts

Creates a new post for a specific blog.

Request body:

{
  "author_id": "string|required",
  "slug": "string|required",
  "title": "string|required",
  "exerpt": "string|required",
  "body": "string|required",
  "feature_image": "string|optional",
  "feature_image_caption": "string|optional",
}

The response will be the same as the "Get a Post" action.

Update a Post

Route: PUT /api/blogs/{blogId}/posts/{postId}

Updates an existing post's details. Required path parameters: blogId, postId

Request body:

{
  "author_id": "string|optional",
  "slug": "string|optional",
  "title": "string|optional",
  "exerpt": "string|optional",
  "body": "string|optional",
  "feature_image": "string|optional",
  "feature_image_caption": "string|optional",
}

The response will be the same as the "Get a Post" action.

Delete a Post

Route: DELETE /api/blogs/{blogId}/posts/{postId}

Deletes a specific post. Required path parameters: blogId, postId. There is no request body.

Example response:

{
  "message": "Delete successful."
}

Share post: