Nov 16, 2024

Kneady API Documentation - Post Management Endpoints

RESTful API documentation for managing blog posts on Kneady. Includes endpoints for retrieving, updating, and managing individual posts as well as listing all posts for a site.

2 min read
by Moumen
Kneady API Documentation - Post Management Endpoints

Base URL

Base URL: https://kneady.dev/api/v1

Authentication

All endpoints require authentication using an API key passed in the x-api-key header.

Request Header
x-api-key: your-api-key

GET /sites/{siteId}/posts

Retrieve all posts for a site. Posts are returned in descending order by creation date.

Posts Path Parameters

  • siteId: The unique identifier of the site

Posts Query Parameters

  • limit (optional): Number of posts to return. If not provided, returns all posts. Example: /sites/\{siteId\}/posts?limit=10

Posts Response

Success Response (200 OK)
{ "count": number, "posts": [ { "id": "string", "title": "string", "description": "string", "image": "string", "imageBlurhash": "string", "slug": "string", "link": "string", "createdAt": "string (ISO date)", "updatedAt": "string (ISO date)", "published": boolean, "author": "string" } ], "url": "string", "customUrl": "string" }

Posts Error Responses

  • 400 Bad Request: Missing x-api-key header or siteId
  • 401 Unauthorized: Invalid API key
  • 404 Not Found: No posts found
  • 500 Internal Server Error: Server error while processing request

GET /sites/{siteId}/posts/{postId}

Retrieve a specific post by ID.

GET Path Parameters

  • siteId: The unique identifier of the site
  • postId: The unique identifier of the post

GET Response

Success Response (200 OK)
{ "title": "string", "description": "string", "image": "string", "imageBlurhash": "string", "slug": "string", "createdAt": "string (ISO date)", "updatedAt": "string (ISO date)", "published": boolean, "author": "string", "link": "string", "url": "string", "customUrl": "string" }

GET Error Responses

  • 400 Bad Request: Possibly missing x-api-key header
  • 401 Unauthorized: Invalid API key
  • 404 Not Found: Post not found
  • 500 Internal Server Error: Server error while processing request

PATCH /sites/{siteId}/posts/{postId}

Update a specific post by ID.

PATCH Path Parameters

  • siteId: The unique identifier of the site
  • postId: The unique identifier of the post

PATCH Request Body

All fields are optional. Only provided fields will be updated.

Request Body
{ "title": "string", "description": "string", "image": "string", "slug": "string", "content": "string", "published": boolean, "link": "string", "author": "string" }

PATCH Notes

  • If slug is provided as an empty string or null, a new random 7-character slug will be generated
  • When an image is updated, a new blurhash will be automatically generated

PATCH Response

Success Response (200 OK)
{ "title": "string", "description": "string", "image": "string", "imageBlurhash": "string", "slug": "string", "createdAt": "string (ISO date)", "updatedAt": "string (ISO date)", "published": boolean, "author": "string", "link": "string", "url": "string", "customUrl": "string" }

PATCH Error Responses

  • 400 Bad Request: Missing x-api-key header or required parameters

  • 401 Unauthorized: Invalid API key

  • 500 Internal Server Error: Server error while processing request

DELETE /sites/{siteId}/posts/{postId}

Delete a specific post by ID.

DELETE Path Parameters

  • siteId: The unique identifier of the site
  • postId: The unique identifier of the post

DELETE Response

Success Response (200 OK)
Post successfully deleted

DELETE Error Responses

  • 400 Bad Request: Missing x-api-key header or required parameters
  • 401 Unauthorized: Invalid API key
  • 500 Internal Server Error: Server error while processing request

On this page

  • Base URL
  • Authentication
  • GET /sites/{siteId}/posts
  • Posts Path Parameters
  • Posts Query Parameters
  • Posts Response
  • Posts Error Responses
  • GET /sites/{siteId}/posts/{postId}
  • GET Path Parameters
  • GET Response
  • GET Error Responses
  • PATCH /sites/{siteId}/posts/{postId}
  • PATCH Path Parameters
  • PATCH Request Body
  • PATCH Notes
  • PATCH Response
  • PATCH Error Responses
  • DELETE /sites/{siteId}/posts/{postId}
  • DELETE Path Parameters
  • DELETE Response
  • DELETE Error Responses
Continue Reading
kneady