This API provides endpoints for managing a blog system with an admin panel. The API supports user authentication, blog post management, category organization, and contact form submissions.
http://localhost:5000/api
Most endpoints require JWT authentication. Include the token in the Authorization header:
Authorization: Bearer your-token-here
Register a new user account.
{
"username": "john_doe",
"email": "john@example.com",
"password": "secure_password123"
}
{
"message": "User registered successfully"
}
Authenticate user and get access token.
{
"email": "john@example.com",
"password": "secure_password123"
}
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1...",
"user": {
"id": 1,
"email": "john@example.com",
"username": "john_doe"
}
}
Get list of all categories.
{
"message": "Categories retrieved successfully",
"data": [
{
"id": 1,
"name": "Technology",
"type": "blog",
"featured_post_id": null,
"created_at": "2024-01-01 12:00:00"
}
]
}
Create a new category.
{
"name": "Technology",
"type": "blog"
}
{
"message": "Category created successfully",
"id": 1
}
Get the current user's profile information.
{
"message": "Profile retrieved successfully",
"data": {
"id": 1,
"username": "john_doe",
"email": "john@example.com",
"created_at": "2024-01-01 12:00:00"
}
}
Get list of blog posts with pagination and filters.
{
"message": "Posts retrieved successfully",
"data": [
{
"id": 1,
"title": "Sample Post",
"subtitle": "A brief introduction",
"content": "Post content here...",
"status": "published",
"category_id": 1,
"category_name": "Technology",
"author_id": 1,
"author_name": "john_doe",
"read_time": 5,
"tags": ["tech", "intro"],
"created_at": "2024-01-01 12:00:00"
}
],
"pagination": {
"total": 10,
"page": 1,
"limit": 10,
"total_pages": 1
}
}
Create a new blog post.
{
"title": "My New Post",
"subtitle": "An interesting subtitle",
"content": "Post content here...",
"category_id": 1,
"status": "draft",
"tags": ["tech", "tutorial"]
}
{
"message": "Post created successfully",
"id": 1
}
Update an existing blog post.
{
"id": 1,
"title": "Updated Title",
"content": "Updated content...",
"status": "published"
}
{
"message": "Post updated successfully",
"id": 1
}
Delete a blog post.
{
"id": 1
}
{
"message": "Post deleted successfully",
"id": 1
}
Submit a contact form message.
{
"name": "John Doe",
"email": "john@example.com",
"message": "Hello, I have a question..."
}
{
"message": "Message sent successfully",
"id": 1
}
Get list of contact form submissions (Admin only).
{
"message": "Messages retrieved successfully",
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"message": "Hello, I have a question...",
"status": "new",
"created_at": "2024-01-01 12:00:00"
}
],
"pagination": {
"total": 1,
"page": 1,
"limit": 10,
"total_pages": 1
}
}