A powerful, developer-friendly platform designed to make managing and publishing blog content effortless across websites. with a simple RESTful interface, flexible content modelling and seamless integration, you get total control over your blog, from writing to publishing; anywhere, anytime. Scalable, secure and built for speed
This document describes the API endpoints available in the admin.routes.js
file for the Publish Flow application. All endpoints are prefixed with /admin
(assuming this router is mounted at /admin
).
- Endpoint:
GET /admin/posts
- Description: Retrieves a list of all posts in the system.
- Request Parameters: None
- Query Parameters:
- May support pagination, filtering, or sorting (see controller for details)
- Response:
200 OK
: Array of post objects500 Internal Server Error
: On failure
- Endpoint:
POST /admin/posts
- Description: Creates a new post.
- Request Body:
title
(string): Title of the postcontent
(string): Content/body of the postcategory
(string or ID): Category for the postauthor
(string or ID): Author of the post- Additional fields as required by the model
- Response:
201 Created
: Created post object400 Bad Request
: Validation error500 Internal Server Error
: On failure
- Endpoint:
GET /admin/posts/:id
- Description: Retrieves details of a single post by its ID.
- Path Parameters:
id
(string): Unique identifier of the post
- Response:
200 OK
: Post object404 Not Found
: If post does not exist500 Internal Server Error
: On failure
- Endpoint:
PUT /admin/posts/:id
- Description: Updates an existing post by its ID.
- Path Parameters:
id
(string): Unique identifier of the post
- Request Body:
- Fields to update (e.g.,
title
,content
,category
, etc.)
- Fields to update (e.g.,
- Response:
200 OK
: Updated post object400 Bad Request
: Validation error404 Not Found
: If post does not exist500 Internal Server Error
: On failure
- Endpoint:
DELETE /admin/posts/:id
- Description: Deletes a post by its ID.
- Path Parameters:
id
(string): Unique identifier of the post
- Response:
200 OK
: Success message or deleted post object404 Not Found
: If post does not exist500 Internal Server Error
: On failure
- Endpoint:
ALL /admin/search
- Description: Performs a search across posts, categories, or users. Accepts any HTTP method.
- Request Parameters:
- Varies by method and search type (see controller for details)
- Query Parameters:
q
(string): Search query- Additional filters as supported
- Response:
200 OK
: Search results (array of objects)400 Bad Request
: Invalid query500 Internal Server Error
: On failure
- Endpoint:
GET /admin/autocomplete
- Description: Provides autocomplete suggestions for search queries.
- Query Parameters:
q
(string): Partial search term
- Response:
200 OK
: Array of suggestion strings or objects400 Bad Request
: Invalid query500 Internal Server Error
: On failure
- Note: The authentication middleware is present but commented out. If enabled, all routes will require authentication (e.g., JWT token in headers).
- All endpoints return appropriate HTTP status codes and error messages on failure.
Request:
POST /admin/posts
Content-Type: application/json
{
"title": "New Post",
"content": "This is the body of the post.",
"category": "news",
"author": "admin"
}
Response:
201 Created
{
"id": "123",
"title": "New Post",
"content": "This is the body of the post.",
"category": "news",
"author": "admin",
...
}
For more details, refer to the controller implementations in Server/Controllers/admin.controller.js
.