Nov 16, 2024

Kneady API Documentation - Products Management Endpoints

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

2 min read
by Moumen
Kneady API Documentation - Products 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]/products

Retrieve all product pages for a site. Product pages are returned in descending order by creation date.

Products Path Parameters

  • siteId: The unique identifier of the site

Products Query Parameters

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

Products Response

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

Products Error Responses

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

GET /sites/[siteId]/products/[productId]

Retrieve a specific product page by ID.

GET Path Parameters

  • siteId: The unique identifier of the site
  • productId: The unique identifier of the product page

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, "price": "string", "link": "string", "cta": "string", "url": "string", "customUrl": "string" }

GET Error Responses

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

PATCH /sites/[siteId]/products/[productId]

Update a specific product page by ID.

PATCH Path Parameters

  • siteId: The unique identifier of the site
  • productId: The unique identifier of the product page

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, "price": "string", "link": "string", "cta": "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
  • If price is empty or null, it defaults to "Free"
  • If link is empty or null, it defaults to the root domain
  • If cta is empty or null, it defaults to "Check Availability"

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, "price": "string", "link": "string", "cta": "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]/products/[productId]

Delete a specific product page by ID.

DELETE Path Parameters

  • siteId: The unique identifier of the site
  • productId: The unique identifier of the product page

DELETE Response

./
Product 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]/products
  • Products Path Parameters
  • Products Query Parameters
  • Products Response
  • Products Error Responses
  • GET /sites/[siteId]/products/[productId]
  • GET Path Parameters
  • GET Response
  • GET Error Responses
  • PATCH /sites/[siteId]/products/[productId]
  • PATCH Path Parameters
  • PATCH Request Body
  • PATCH Notes
  • PATCH Response
  • PATCH Error Responses
  • DELETE /sites/[siteId]/products/[productId]
  • DELETE Path Parameters
  • DELETE Response
  • DELETE Error Responses
Continue Reading
kneady