Knowledge Base API

API Documentation

Welcome to the Knowledge Base API. This API allows you to access and manage knowledge base articles.

GET /kb/api/articles

Retrieves a list of all knowledge base articles.

Query Parameters

  • search: string (Optional) - Filter articles by keyword.
  • category: string (Optional) - Filter articles by category.
  • limit: integer (Optional, default: 10) - Maximum number of articles to return.
  • offset: integer (Optional, default: 0) - Number of articles to skip.

Success Response (200 OK)

  • An array of article objects, each containing:
    • id (integer): Unique identifier for the article.
    • title (string): The title of the article.
    • category (string): The category the article belongs to.
    • summary (string): A brief summary of the article content.
    • published_at (string): The date and time the article was published (ISO 8601 format).
Example Request:
GET /kb/api/articles?search=api&category=documentation&limit=5
GET /kb/api/articles/{id}

Retrieves a specific knowledge base article by its ID.

Path Parameters

  • id: integer (Required) - The ID of the article to retrieve.

Success Response (200 OK)

  • A single article object with detailed content:
    • id (integer): Unique identifier for the article.
    • title (string): The title of the article.
    • category (string): The category the article belongs to.
    • content (string): The full content of the article (e.g., Markdown or HTML).
    • published_at (string): The date and time the article was published (ISO 8601 format).
    • updated_at (string): The date and time the article was last updated (ISO 8601 format).

Error Response (404 Not Found)

  • If the article with the specified ID does not exist.
Example Request:
GET /kb/api/articles/123
POST /kb/api/articles

Creates a new knowledge base article.

Request Body (JSON)

  • title: string (Required) - The title of the new article.
  • category: string (Required) - The category for the new article.
  • content: string (Required) - The full content of the new article.
  • summary: string (Optional) - A brief summary.

Success Response (201 Created)

  • The newly created article object, including its assigned ID.

Error Response (400 Bad Request)

  • If the request body is missing required fields or is malformed.
Example Request Body:
{ "title": "Getting Started with the API", "category": "API Usage", "content": "This article covers the basic endpoints of our API...", "summary": "Introduction to our API." }
PUT /kb/api/articles/{id}

Updates an existing knowledge base article by its ID.

Path Parameters

  • id: integer (Required) - The ID of the article to update.

Request Body (JSON)

  • title: string (Optional) - The new title for the article.
  • category: string (Optional) - The new category for the article.
  • content: string (Optional) - The new full content of the article.
  • summary: string (Optional) - The new summary.

Success Response (200 OK)

  • The updated article object.

Error Response (404 Not Found)

  • If the article with the specified ID does not exist.
Example Request Body:
{ "content": "Updated content with more details...", "summary": "Revised summary." }
DELETE /kb/api/articles/{id}

Deletes a knowledge base article by its ID.

Path Parameters

  • id: integer (Required) - The ID of the article to delete.

Success Response (204 No Content)

  • Indicates successful deletion with no response body.

Error Response (404 Not Found)

  • If the article with the specified ID does not exist.
Example Request:
DELETE /kb/api/articles/456