An example of Restful API for a task management application
you can test the API with Postman at the following url:
https://monteil-task-manager.herokuapp.com
ALL AUTHENTICATED ROUTES WILL EXPECT A JWT CONTAINING THE USER ID
The Bearer token must be used within the HTTP request headers using the following pattern:
const response = await fetch("https://monteil-task-manager.herokuapp.com/tasks", {
method: "GET",
headers: {
"Authorization": "Bearer <YourToken>",
"Content-Type": "application/json",
"Accept": "*/*"
}
});
Demo user email: demo@demo.com
Demo user password: Demo123!
TASKS ROUTES:
Read tasks options (GET method), authenticated:
/tasks?completed=true
/tasks?limit=10&skip=20
/tasks?sortBy=createdAt:asc
/tasks
Read task (GET method), authenticated:
https://monteil-task-manager.herokuapp.com/tasks/:id
Update task (PATCH method), authenticated:
https://monteil-task-manager.herokuapp.com/tasks/:id
takes an object with the following blueprint:
{
"description": "YourDescription"
}
Create task (POST method), authenticated:
https://monteil-task-manager.herokuapp.com/tasks
takes an object with the following blueprint:
{
"description": "YourDescription"
}
Delete task (DELETE method), authenticated:
https://monteil-task-manager.herokuapp.com/tasks/:id
===================================================
USERS ROUTES:
Read use profile (GET method), authenticated:
https://monteil-task-manager.herokuapp.com/users/me
Update user (PATCH method), authenticated:
https://monteil-task-manager.herokuapp.com/users/me
takes an object with the following blueprint:
{
"name": "YourName",
"email": "YourEmail",
"password": "YourPassword",
"age": age (number)
}
Create user (POST method):
https://monteil-task-manager.herokuapp.com/users
takes an object with the following blueprint:
{
"name": "YourName",
"email": "YourEmail",
"password": "YourPassword",
"age": age (number) (optional)
}
Login user (POST method):
https://monteil-task-manager.herokuapp.com/users/login
takes an object with the following blueprint:
{
"email": "YourEmail",
"password": "YourPassword"
}
Logout user (POST method), authenticated:
https://monteil-task-manager.herokuapp.com/users/logout
Logout all sessions (POST method), authenticated:
https://monteil-task-manager.herokuapp.com/users/logoutAll
Delete user (DELETE method), authenticated:
https://monteil-task-manager.herokuapp.com/users/me
Upload avatar (POST method), authenticated:
https://monteil-task-manager.herokuapp.com/users/me/avatar
takes an object with the following blueprint:
{
"avatar": file
}
Delete avatar (DELETE method), authenticated:
https://monteil-task-manager.herokuapp.com/users/me/avatar
Fetch avatar (GET method):
https://monteil-task-manager.herokuapp.com/users/:id/avatar