http://localhost:8080/api/v1
- POST
/auth/register - Auth Required: No
- Body:
{
"username": "johndoe",
"email": "john@example.com",
"password": "SecurePass123!"
}- Response: Success message, user data
- POST
/auth/login - Auth Required: No
- Body:
{
"email": "john@example.com",
"password": "SecurePass123!"
}- Response: JWT token, user data
- Note: Save the
tokenfrom response for authenticated requests
- GET
/auth/verify-email?token={verification_token} - Auth Required: No
- Response: Email verification success
- POST
/auth/resend-verification - Auth Required: No
- Body:
{
"email": "john@example.com"
}- POST
/auth/logout - Auth Required: Yes
- Headers:
Authorization: Bearer {token}
- POST
/auth/forgot-password - Auth Required: No
- Body:
{
"email": "john@example.com"
}- POST
/auth/reset-password - Auth Required: No
- Body:
{
"token": "reset-token-from-email",
"newPassword": "NewSecure123!",
"confirmPassword": "NewSecure123!"
}- POST
/auth/change-password - Auth Required: Yes
- Body:
{
"currentPassword": "SecurePass123!",
"newPassword": "NewSecure456!",
"confirmPassword": "NewSecure456!"
}- GET
/auth/profile - Auth Required: Yes
- Response: Current user's profile data
- POST
/auth/request-role-upgrade - Auth Required: Yes
- Body:
{
"requestedRole": "AUTHOR",
"reason": "I want to publish blog posts"
}- POST
/auth/admin/change-user-role - Auth Required: Yes (ADMIN or SUPER_ADMIN)
- Body:
{
"username": "johndoe",
"newRole": "EDITOR"
}- Roles: SUBSCRIBER, CONTRIBUTOR, AUTHOR, EDITOR, ADMIN, SUPER_ADMIN
- GET
/auth/admin/users - Auth Required: Yes (ADMIN or SUPER_ADMIN)
- Response: List of all users
- POST
/posts - Auth Required: Yes (CONTRIBUTOR+)
- Body:
{
"title": "My First Blog Post",
"content": "This is the full content with **markdown** support!",
"excerpt": "A brief description of the post",
"coverImage": "http://localhost:8080/api/v1/media/images/image_20251020_123456_abc123.jpg",
"published": true,
"categoryId": 1,
"tags": ["technology", "web-development", "java"]
}- GET
/posts?page=0&size=10&sortBy=createdAt&sortDir=desc - Auth Required: No
- Query Params:
page(0-indexed, default: 0)size(1-100, default: 10)sortBy(createdAt, title, likeCount, viewCount)sortDir(asc, desc)
- GET
/posts/all?page=0&size=10&sortBy=createdAt&sortDir=desc - Auth Required: Yes (EDITOR+)
- Note: Includes drafts and unpublished posts
- GET
/posts/my-posts?page=0&size=10 - Auth Required: Yes
- Response: All posts created by authenticated user
- GET
/posts/author/{username}?page=0&size=10 - Auth Required: No
- Example:
/posts/author/johndoe?page=0&size=10
- GET
/posts/{id} - Auth Required: No
- Example:
/posts/123 - Note: Increments view count
- GET
/posts/slug/{slug} - Auth Required: No
- Example:
/posts/slug/my-first-blog-post-20251020
- PUT
/posts/{id} - Auth Required: Yes (Author or EDITOR+)
- Body: Same as Create Post
- Note: Authors can only update their own posts
- DELETE
/posts/{id} - Auth Required: Yes (Author or EDITOR+)
- Note: Authors can only delete their own posts
- POST
/posts/{id}/like - Auth Required: Yes
- Note: Toggle - if liked, unlikes; if not liked, likes
- GET
/posts/search?q=technology&page=0&size=10 - Auth Required: No
- Query Params:
q(search query - searches title, content, excerpt)page,size,sortBy,sortDir
- GET
/posts/popular?limit=10 - Auth Required: No
- Query Params:
limit(1-50, default: 10)
- Note: Sorted by views + likes
- GET
/posts/recent?limit=10 - Auth Required: No
- Query Params:
limit(1-50, default: 10)
- GET
/posts/stats - Auth Required: Yes
- Response:
{
"totalPosts": 25,
"publishedPosts": 20,
"draftPosts": 5,
"totalViews": 1523,
"totalLikes": 342
}- POST
/comments/post/{postId} - Auth Required: Yes
- Body:
{
"content": "Great post! Very informative.",
"parentId": null
}- Note: Set
parentIdto null for top-level comment
- POST
/comments/post/{postId} - Auth Required: Yes
- Body:
{
"content": "Thanks for your feedback!",
"parentId": 5
}- Note: Set
parentIdto comment ID you're replying to
- GET
/comments/post/{postId}?page=0&size=10&sortBy=createdAt&sortDir=asc - Auth Required: No
- Note: Returns top-level comments only
- GET
/comments/post/{postId}/all - Auth Required: No
- Note: Returns all comments with nested replies (up to 5 levels deep)
- GET
/comments/{id} - Auth Required: No
- PUT
/comments/{id}?content=Updated content here - Auth Required: Yes (Comment author only)
- Query Params:
content(new comment text)
- DELETE
/comments/{id} - Auth Required: Yes (Comment author, post author, or EDITOR+)
- GET
/comments/user/{username}?page=0&size=10 - Auth Required: No
- Example:
/comments/user/johndoe?page=0&size=10
- GET
/comments/my-comments?page=0&size=10 - Auth Required: Yes
- GET
/comments/recent?limit=10 - Auth Required: No
- Query Params:
limit(1-50, default: 10)
- GET
/comments/post/{postId}/count - Auth Required: No
- Response: Number of comments on the post
- GET
/comments/stats - Auth Required: Yes
- Response:
{
"totalComments": 156,
"repliesReceived": 42,
"commentsThisWeek": 18
}- GET
/categories - Auth Required: No
- Response: List of all categories sorted by name
- GET
/categories/{id} - Auth Required: No
- GET
/categories/slug/{slug} - Auth Required: No
- Example:
/categories/slug/technology
- GET
/categories/{id}/posts?page=0&size=10&sortBy=createdAt&sortDir=desc - Auth Required: No
- POST
/categories - Auth Required: Yes (EDITOR+ or ADMIN)
- Body:
{
"name": "Technology",
"description": "Posts about tech and programming"
}- Note: Slug is auto-generated from name
- PUT
/categories/{id} - Auth Required: Yes (EDITOR+ or ADMIN)
- Body: Same as Create Category
- DELETE
/categories/{id} - Auth Required: Yes (ADMIN only)
- Note: Cannot delete if category has associated posts
- GET
/tags - Auth Required: No
- Response: List of all tags sorted by name
- GET
/tags/popular?limit=20 - Auth Required: No
- Query Params:
limit(1-100, default: 20)
- Note: Sorted by post count
- GET
/tags/{id} - Auth Required: No
- GET
/tags/slug/{slug} - Auth Required: No
- Example:
/tags/slug/web-development
- GET
/tags/{id}/posts?page=0&size=10&sortBy=createdAt&sortDir=desc - Auth Required: No
- GET
/tags/search?q=java&limit=20 - Auth Required: No
- Query Params:
q(search query)limit(1-100, default: 20)
- POST
/tags?name=JavaScript - Auth Required: Yes (EDITOR+ or ADMIN)
- Query Params:
name(tag name)
- Note: Slug is auto-generated
- PUT
/tags/{id}?name=TypeScript - Auth Required: Yes (EDITOR+ or ADMIN)
- Query Params:
name(new tag name)
- DELETE
/tags/{id} - Auth Required: Yes (ADMIN only)
- Note: Cannot delete if tag has associated posts
- POST
/media/upload/image - Auth Required: Yes
- Content-Type:
multipart/form-data - Form Data:
- Key:
file - Value: (Select image file)
- Key:
- Allowed Types: JPEG, PNG, GIF, WebP
- Max Size: 10MB
- Response:
{
"filename": "image_20251020_123456_abc123.jpg",
"originalName": "my-photo.jpg",
"url": "http://localhost:8080/api/v1/media/images/image_20251020_123456_abc123.jpg",
"size": "2048576",
"type": "image/jpeg"
}- POST
/media/upload/file - Auth Required: Yes
- Content-Type:
multipart/form-data - Form Data:
- Key:
file - Value: (Select file)
- Key:
- Allowed Types: PDF, Word (.doc, .docx), Text (.txt), ZIP
- Max Size: 10MB
- GET
/media/images/{filename} - Auth Required: No
- Example:
/media/images/image_20251020_123456_abc123.jpg - Response: Binary image data
- GET
/media/files/{filename} - Auth Required: No
- Example:
/media/files/file_20251020_123456_def456.pdf - Response: Binary file data (with download header)
- DELETE
/media/{type}/{filename} - Auth Required: Yes
- Example:
/media/images/image_20251020_123456_abc123.jpg - Path Params:
type(images or files)filename(exact filename)
- POST
/contact - Auth Required: No
- Body:
{
"name": "John Doe",
"email": "john@example.com",
"message": "I have a question about your platform..."
}- Response: Success confirmation message
- GET
/auth/get-verification-token?email=test@example.com - Auth Required: No
- Response: Returns verification token for testing
- GET
/auth/get-reset-token?email=test@example.com - Auth Required: No
- Response: Returns password reset token for testing
- DELETE
/auth/clear-all-users - Auth Required: No
- Response: Deletes all users (for testing cleanup)
- GET
/auth/test - Auth Required: No
- Response: "Auth controller is working!"
{
"success": true,
"message": "Operation completed successfully",
"data": { /* ... actual data ... */ }
}{
"success": false,
"message": "Operation failed",
"error": "Detailed error description"
}{
"success": true,
"message": "Data retrieved successfully",
"data": {
"content": [ /* ... array of items ... */ ],
"pageable": {
"pageNumber": 0,
"pageSize": 10
},
"totalElements": 50,
"totalPages": 5,
"number": 0,
"size": 10,
"first": true,
"last": false,
"empty": false
}
}For endpoints that require authentication, include:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
- 200 OK - Request successful
- 201 Created - Resource created successfully
- 400 Bad Request - Invalid request data
- 401 Unauthorized - Missing or invalid authentication token
- 403 Forbidden - Insufficient permissions
- 404 Not Found - Resource not found
- 409 Conflict - Resource already exists
- 500 Internal Server Error - Server error
- Register β POST
/auth/register - Get Token β GET
/auth/get-verification-token?email=your@email.com - Verify β GET
/auth/verify-email?token=TOKEN - Login β POST
/auth/login(save the token!) - Create Post β POST
/posts(use token) - Upload Image β POST
/media/upload/image(use token) - Add Comment β POST
/comments/post/{postId}(use token) - Like Post β POST
/posts/{id}/like(use token) - Search β GET
/posts/search?q=keyword - View Stats β GET
/posts/stats(use token)
Total Endpoints: 68
- Authentication: 12 (including 3 testing endpoints)
- Posts: 14
- Comments: 12
- Categories: 7
- Tags: 9
- Media: 5
- Contact: 1
- Testing: 4 (development only)
Generated: October 2025
Platform: Multi-User Blogging Platform API v1.0