- Open Postman
- Click Import button (top left)
- Select Multi-User-Blog-API.postman_collection.json
- Collection will appear in your Collections sidebar
- Click the Environments tab (left sidebar)
- Click Import
- Select Multi-User-Blog-API.postman_environment.json
- Select the environment from the dropdown (top right)
Your collection is ready to use. The environment is configured with:
base_url: http://localhost:8080/api/v1token: (auto-saved after login)user_id: (auto-saved after login)username: (auto-saved after login)
| Category | Endpoints | Authentication Required |
|---|---|---|
| Authentication | 11 | Mixed (login/register = No, others = Yes) |
| Posts | 14 | Mixed (read = No, write = Yes) |
| Comments | 10 | Mixed (read = No, write = Yes) |
| Categories | 6 | Mixed (read = No, write = Yes) |
| Tags | 8 | Mixed (read = No, write = Yes) |
| Media | 4 | Yes (all require auth) |
| Contact | 1 | No |
POST /api/v1/auth/register
Body: {
"username": "testuser",
"email": "test@example.com",
"password": "SecurePass123!"
}
✅ Response: Registration successful message
GET /api/v1/auth/get-verification-token?email=test@example.com
✅ Response: Returns verification token
GET /api/v1/auth/verify-email?token={verification_token}
✅ Response: Email verified successfully
POST /api/v1/auth/login
Body: {
"email": "test@example.com",
"password": "SecurePass123!"
}
✅ Token is automatically saved to environment variables!
All subsequent requests will use the token automatically via {{token}} variable.
- Login → Token saved
- Create Post (POST
/posts){ "title": "My First Post", "content": "This is amazing content!", "published": true, "categoryId": 1, "tags": ["technology", "web"] } - Get My Posts (GET
/posts/my-posts) - Update Post (PUT
/posts/{id}) - Like Post (POST
/posts/{id}/like) - Add Comment (POST
/comments/post/{postId}) - Delete Post (DELETE
/posts/{id})
- Get Popular Posts (GET
/posts/popular) - Search Posts (GET
/posts/search?q=technology) - Get Posts by Category (GET
/categories/{id}/posts) - Get Posts by Tag (GET
/tags/{id}/posts) - Get Popular Tags (GET
/tags/popular)
- Get Profile (GET
/auth/profile) - Change Password (POST
/auth/change-password) - Get Post Stats (GET
/posts/stats) - Get Comment Stats (GET
/comments/stats)
- Upload Cover Image (POST
/media/upload/image)- Use form-data with key:
file, value: (select image)
- Use form-data with key:
- Use returned URL in post creation
- Delete Media if needed (DELETE
/media/images/{filename})
The environment file contains these variables:
| Variable | Description | Auto-Set |
|---|---|---|
base_url |
API base URL (http://localhost:8080/api/v1) | No |
token |
JWT authentication token | Yes (after login) |
user_id |
Logged-in user ID | Yes (after login) |
username |
Logged-in username | Yes (after login) |
post_id |
Last created post ID | Manual |
comment_id |
Last created comment ID | Manual |
category_id |
Last created category ID | Manual |
tag_id |
Last created tag ID | Manual |
{{base_url}}/posts
Authorization: Bearer {{token}}
Multi-User Blogging Platform API/
├── 🔐 Authentication/
│ ├── Register User
│ ├── Login (auto-saves token)
│ ├── Verify Email
│ ├── Resend Verification
│ ├── Forgot Password
│ ├── Reset Password
│ ├── Change Password
│ ├── Get Profile
│ ├── Request Role Upgrade
│ ├── Change User Role (Admin)
│ ├── Get All Users (Admin)
│ └── Logout
│
├── 📝 Posts/
│ ├── Create Post
│ ├── Get All Published Posts
│ ├── Get All Posts (Admin)
│ ├── Get My Posts
│ ├── Get Posts by Author
│ ├── Get Post by ID
│ ├── Get Post by Slug
│ ├── Update Post
│ ├── Delete Post
│ ├── Like/Unlike Post
│ ├── Search Posts
│ ├── Get Popular Posts
│ ├── Get Recent Posts
│ └── Get Post Statistics
│
├── 💬 Comments/
│ ├── Create Comment
│ ├── Create Reply to Comment
│ ├── Get Comments for Post (Paginated)
│ ├── Get All Comments for Post (Nested)
│ ├── Get Comment by ID
│ ├── Update Comment
│ ├── Delete Comment
│ ├── Get Comments by User
│ ├── Get My Comments
│ ├── Get Recent Comments
│ ├── Get Comment Count for Post
│ └── Get Comment Statistics
│
├── 📁 Categories/
│ ├── Get All Categories
│ ├── Get Category by ID
│ ├── Get Category by Slug
│ ├── Get Posts by Category
│ ├── Create Category (Admin/Editor)
│ ├── Update Category (Admin/Editor)
│ └── Delete Category (Admin)
│
├── 🏷️ Tags/
│ ├── Get All Tags
│ ├── Get Popular Tags
│ ├── Get Tag by ID
│ ├── Get Tag by Slug
│ ├── Get Posts by Tag
│ ├── Search Tags
│ ├── Create Tag (Admin/Editor)
│ ├── Update Tag (Admin/Editor)
│ └── Delete Tag (Admin)
│
├── 📷 Media/
│ ├── Upload Image
│ ├── Upload File
│ ├── Get Image
│ ├── Get File
│ └── Delete Media
│
└── 📧 Contact/
└── Submit Contact Form
- SUBSCRIBER (Level 1) - Read-only, can like/comment
- CONTRIBUTOR (Level 2) - Create posts (drafts only)
- AUTHOR (Level 3) - Create & publish own posts
- EDITOR (Level 4) - Edit all posts, moderate comments
- ADMIN (Level 5) - Full access, user management
- SUPER_ADMIN (Level 6) - Complete system control
- Register multiple users
- Use Admin account to upgrade roles:
POST /api/v1/auth/admin/change-user-role { "username": "testuser", "newRole": "AUTHOR" } - Test endpoint access with different role tokens
page- Page number (0-indexed, default: 0)size- Items per page (1-100, default: 10)sortBy- Field to sort by (e.g., createdAt, title)sortDir- Sort direction (asc/desc, default: desc)
Example:
GET /api/v1/posts?page=0&size=20&sortBy=createdAt&sortDir=desc
q- Search query stringlimit- Maximum results
Example:
GET /api/v1/posts/search?q=technology&page=0&size=10
- Start with Authentication (register → verify → login)
- Then test CRUD operations (create → read → update → delete)
- Finally test advanced features (search, stats, popular)
- Use DELETE endpoints to clean up test data
- Or use the
/auth/clear-all-usersendpoint (testing only)
- Try endpoints without authentication
- Test with invalid IDs
- Test with missing required fields
- Test with role restrictions
- Save common workflows as Collections
- Use Pre-request Scripts for setup
- Use Tests tab for assertions
{
"success": true,
"message": "Operation successful",
"data": { /* ... response data ... */ }
}{
"success": false,
"message": "Operation failed",
"error": "Detailed error message"
}{
"success": true,
"message": "Data retrieved successfully",
"data": {
"content": [ /* ... items ... */ ],
"totalElements": 50,
"totalPages": 5,
"number": 0,
"size": 10,
"first": true,
"last": false
}
}✅ Solution: Check the Tests tab in Login request. Ensure script is present:
if (pm.response.code === 200) {
var jsonData = pm.response.json();
pm.environment.set("token", jsonData.token);
}✅ Solution:
- Ensure you're logged in
- Check token is in environment variables
- Verify email before login
- Token might be expired (login again)
✅ Solution: Your user role doesn't have permission for this endpoint. Upgrade role via admin.
✅ Solution: Start backend: cd backend && ./mvnw spring-boot:run
✅ Solution:
- Use form-data (not JSON)
- Key must be "file"
- Select file from your system
- Ensure file is under 10MB
Save commonly used IDs:
// In Tests tab after creating a post
pm.collectionVariables.set("post_id", pm.response.json().data.id);Use pre-request scripts to call other endpoints:
// Get a fresh token before each request
pm.sendRequest({
url: pm.environment.get("base_url") + "/auth/login",
method: 'POST',
header: { 'Content-Type': 'application/json' },
body: { /* ... login credentials ... */ }
}, function (err, res) {
pm.environment.set("token", res.json().token);
});Use Collection Runner:
- Click on collection
- Click "Run" button
- Select requests to run
- Configure iterations and delays
- Run all tests automatically
# Authentication
POST /auth/register # Sign up
POST /auth/login # Sign in (saves token)
GET /auth/profile # Get my info
# Posts
POST /posts # Create post
GET /posts # List all posts
GET /posts/{id} # Get single post
PUT /posts/{id} # Update post
DELETE /posts/{id} # Delete post
POST /posts/{id}/like # Like/unlike
# Comments
POST /comments/post/{postId} # Add comment
GET /comments/post/{postId}/all # Get all comments
PUT /comments/{id} # Edit comment
DELETE /comments/{id} # Delete comment
# Media
POST /media/upload/image # Upload image
POST /media/upload/file # Upload fileBefore considering API fully tested:
- Can register new user
- Can verify email
- Can login and token is saved
- Can create a post
- Can upload and use cover image
- Can add tags and category
- Can like own and others' posts
- Can comment on posts
- Can reply to comments (nested)
- Can edit own content
- Can delete own content
- Can search posts
- Can view statistics
- Can change password
- Admin can manage user roles
- All pagination works
- All error responses are clear
If you encounter issues:
- Check this guide's Troubleshooting section
- Verify backend is running (
http://localhost:8080) - Check Postman Console for detailed error logs
- Ensure all required fields are provided
Happy Testing! 🚀
Generated for: Multi-User Blogging Platform API v1.0 Last Updated: October 2025