Skip to main content

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:
The API endpoints use the /api/v1 path.

1. Register a user

Start by creating a user account. Send a POST request to:
Set the request body to JSON:
Send the request and check the response. A successful request creates the user account.

2. Log in

Next, send a POST request to:
Use the same credentials:
After a successful login, the server creates a JWT and sends it through the tokenName HttpOnly cookie. You do not need to copy the JWT and manually add it as an API key. Postman can store cookies received from the server. After logging in, check the cookies for your local TaskSocial API and look for:
The cookie contains the JWT created by the server. The exact cookie visibility depends on how Postman handles the response and cookie jar.

4. Test a protected endpoint

After logging in, test:
The authentication cookie should be sent with the request. If the cookie contains a valid JWT, the backend verifies it and returns the authenticated user’s tasks.

5. Create a task

With the authenticated session, send:
Use a JSON request body:
A successful response confirms that authentication, routing, controller logic, and database operations are working together.

6. Test the task endpoints

You can continue testing the other task operations:
For update and delete requests, replace :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:
The server clears the authentication cookie. After logging out, try accessing a protected endpoint again:
The request should no longer be authenticated.

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
Testing each part separately makes it easier to identify where a problem occurs. For example:

Common testing flow

A simple testing sequence for TaskSocial is:
This gives you a complete path through the main authentication and task functionality.

API Reference

For all available endpoints, request schemas, response examples, and interactive requests, see the API Reference.