API Testing
You can test the TaskSocial API using Postman. Postman lets you send requests to the API and inspect the responses without needing to build a frontend first. This is useful when developing and debugging the backend.Before you start
Make sure the TaskSocial backend is running locally. The API is available at:/api/v1 path.
1. Register a user
Start by creating a user account. Send aPOST request to:
2. Log in
Next, send aPOST request to:
tokenName HttpOnly cookie.
You do not need to copy the JWT and manually add it as an API key.
3. Check the authentication cookie
Postman can store cookies received from the server. After logging in, check the cookies for your local TaskSocial API and look for:4. Test a protected endpoint
After logging in, test:5. Create a task
With the authenticated session, send:6. Test the task endpoints
You can continue testing the other task operations::id with the ID of an existing task.
The backend also checks task ownership before allowing a user to modify or delete a task.
7. Test logout
Finally, send:What to check while testing
When testing an endpoint in Postman, check:- HTTP status code
- Response body
- Response headers
- Authentication cookie
- Validation errors
- Authentication errors
- Task ownership behavior