link deploy
Create a User
-
URL </users/register>
-
Method:
POST
-
URL Params
None
-
Data Params Required:
name=[string]
email=[string]
password=[string]
Optional:
avatar=[string]
-
Sample Request:
axios({
"method": "POST",
"url": "http://{HOST}.com/users/register",
"data": {
"name": "Mona Lisa",
"email": "mona@mail.com",
"password": "PASSWORD",
"avatar": "https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80"
}
})
-
Success Response:
- Code: 201
Content:{ "_id": "5e186c14af790e1a58535cdd", "name": "Mona Lisa", "email": "mona@mail.com", "avatar": "https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80", "createdAt": "2020-01-10T12:20:36.142Z", "updatedAt": "2020-01-10T12:20:36.142Z" }
- Code: 201
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "This email mona@mail.com has already been used!" }
- Code: 500 Internal Server Error
Content:{ error : "" }
- Code: 400 Bad Request
Log In
-
URL </users/login>
-
Method:
POST
-
URL Params
None
-
Data Params Required:
email=[string]
password=[string]
-
Sample Request:
axios({ "method": "POST", "url": "http://{HOST}.com/users/login", "data": { "email": "nina@mail.com", "password": "PASSWORD" } })
-
Success Response:
- Code: 200
Content:{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMTg2YzE0YWY3OTBlMWE1ODUzNWNkZCIsImVtYWlsIjoibW9uYUBtYWlsLmNvbSIsImlhdCI6MTU3ODY2MTYyNywiZXhwIjoxNTc4NjY1MjI3fQ.NvyFqTB0WE5ZXlhU-rC2IidPDucoJNISLK7pNhumRmk" }
- Code: 200
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "Email and/or password incorrect" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 400 Bad Request
Find user by email
-
URL </users/{email}>
-
Method:
GET
-
URL Params
email=[string]
-
Request Headers
Required:access_token=[string]
-
Data Params
None
-
Sample Request:
axios({ "method": "GET", "url": "http://{HOST}.com/users/john@mail.com", "headers": { "access_token": "YOUR_ACCESS_TOKEN" } })
-
Success Response:
- Code: 200
Content:{ "_id": "5e15fe2ed406f210996d4f6a", "name": "John Doe", "email": "john@mail.com", "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png", "createdAt": "2020-01-08T16:07:10.388Z", "updatedAt": "2020-01-08T16:07:10.388Z" }
- Code: 200
-
Error Response:
- Code: 401 Unauthorized
Content:{ error : "You must log in first" }
- Code: 404 Not Found
Content:{ error : "User not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 401 Unauthorized
Get all projects
-
URL </projects>
-
Method:
GET
-
URL Params
None
-
Request Headers
Required:access_token=[string]
-
Data Params
None
-
Sample Request:
axios({
"method": "GET",
"url": "http://{HOST}.com/projects",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:[ { "members": [ { "_id": "5e15fe2ed406f210996d4f6a", "name": "Nana Nina", "email": "nana@mail.com", "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png", "createdAt": "2020-01-08T16:07:10.388Z", "updatedAt": "2020-01-08T16:07:10.388Z" } ], "_id": "5e15ff16d406f210996d4f70", "name": "Nana's First Project", "user": "5e15fe2ed406f210996d4f6a", "tasks": [], "createdAt": "2020-01-08T16:11:02.596Z", "updatedAt": "2020-01-08T16:11:02.596Z" }, { "members": [ { "_id": "5e15fe2ed406f210996d4f6a", "name": "Nana Nina", "email": "nana@mail.com", "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png", "createdAt": "2020-01-08T16:07:10.388Z", "updatedAt": "2020-01-08T16:07:10.388Z" } ], "_id": "5e15ff1fd406f210996d4f71", "name": "Nana's Second Project", "user": "5e15fe2ed406f210996d4f6a", "tasks": [ { "isDone": false, "timeAllocation": 5, "_id": "5e19974bdcc6b7242c12ba38", "title": "Second Task", "description": "This is my second task", "dueDate": "2020-01-11T17:00:00.000Z", "user": "5e15fe88d406f210996d4f6d" } ], "createdAt": "2020-01-08T16:11:11.525Z", "updatedAt": "2020-01-08T16:11:11.525Z" } ]
- Code: 200
-
Error Response:
- Code: 401 Unauthorized
Content:{ error : "You must log in first" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 401 Unauthorized
Create a project
-
URL </projects>
-
Method:
POST
-
URL Params
access_token=[string]
-
Request Headers
Required:access_token=[string]
-
Data Params Required:
name=[string]
-
Sample Request:
axios({
"method": "POST",
"url": "http://{HOST}.com/projects",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
},
"data": {
"name": "January Marketing Campaign"
}
})
-
Success Response:
- Code: 201
Content:{ "members": [ "5e15fe88d406f210996d4f6d" ], "_id": "5e19468dc748361b9ef3d923", "name": "January Marketing Campaign", "user": "5e15fe88d406f210996d4f6d", "tasks": [], "createdAt": "2020-01-11T03:52:45.389Z", "updatedAt": "2020-01-11T03:52:45.389Z" }
- Code: 201
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "Project's name is required" }
- Code: 403 Forbidden
Content:{ error : "You must log in first" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 400 Bad Request
Add a member to project
-
URL </projects/{id}/members>
-
Method:
POST
-
URL Params
id=[string]
-
Request Headers
access_token=[string]
-
Data Params
email=[string]
-
Sample Request:
axios({
"method": "POST",
"url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/members",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
},
"data": {
"email": "mona@mail.com"
}
})
-
Success Response:
- Code: 200
Content:{ "members": [ "5e15fe88d406f210996d4f6d", "5e186c14af790e1a58535cdd" ], "_id": "5e19468dc748361b9ef3d923", "name": "January Marketing Campaign", "user": "5e15fe88d406f210996d4f6d", "tasks": [], "createdAt": "2020-01-11T03:52:45.389Z", "updatedAt": "2020-01-11T08:33:45.285Z" }
- Code: 200
-
Error Response:
- Code: 403 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found Request
Content:{ error : "Project not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 403 Unauthorized
Delete a member from project
-
URL </projects/{id}/members/{email}>
-
Method:
DELETE
-
URL Params
id=[string]
email=[string]
-
Request Headers
access_token=[string]
-
Data Params
None
-
Sample Request:
axios({
"method": "DELETE",
"url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/members/mona@mail.com",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "members": [ "5e15fe88d406f210996d4f6d" ], "_id": "5e19468dc748361b9ef3d923", "name": "January Marketing Campaign", "user": "5e15fe88d406f210996d4f6d", "tasks": [], "createdAt": "2020-01-11T03:52:45.389Z", "updatedAt": "2020-01-11T08:46:38.713Z" }
- Code: 200
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "Can not delete project's owner" }
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found Request
Content:{ error : "User not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 400 Bad Request
Find a project
-
URL </projects/{id}>
-
Method:
GET
-
URL Params
id=[string]
-
Request Headers
access_token=[string]
-
Data Params
None
-
Sample Request:
axios({
"method": "GET",
"url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "members": [ "5e15fe88d406f210996d4f6d" ], "_id": "5e19468dc748361b9ef3d923", "name": "January Marketing Campaign", "user": "5e15fe88d406f210996d4f6d", "tasks": [], "createdAt": "2020-01-11T03:52:45.389Z", "updatedAt": "2020-01-11T08:46:38.713Z" }
- Code: 200
-
Error Response:
- Code: 403 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 403 Unauthorized
Delete a project
-
URL </projects/{id}>
-
Method:
DELETE
-
URL Params
id=[string]
-
Request Headers
access_token=[string]
-
Data Params
None
-
Sample Request:
axios({
"method": "DELETE",
"url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "message": "Project with ID 5e15fec7d406f210996d4f6f successfully deleted" }
- Code: 200
-
Error Response:
- Code: 403 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 403 Unauthorized
Add task to a project
-
URL </projects/{id}/tasks>
-
Method:
POST
-
URL Params
id=[string]
-
Request Headers
access_token=[string]
-
Data Params
Required:title=[string]
Optional:
description=[string]
timeAllocation=[number]
dueDate=[date]
-
Sample Request:
axios({
"method": "POST",
"url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/tasks",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
},
"data": {
"title": "First Task",
"description": "This is my first task",
"dueDate": "2020-01-12T17:00:00.000Z",
"timeAllocation": 3
}
})
-
Success Response:
- Code: 200
Content:{ "isDone": false, "timeAllocation": 3, "_id": "5e19974bdcc6b7242c12ba38", "title": "First Task", "description": "This is my first task", "dueDate": "2020-01-12T17:00:00.000Z", "user": "5e15fe88d406f210996d4f6d" }
- Code: 200
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "Please insert title for the task" }
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found />
Content:
{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 400 Bad Request
Find a task
-
URL </projects/{id}/tasks/{taskId}>
-
Method:
GET
-
URL Params
id=[string]
taskId=[string]
-
Request Headers
access_token=[string]
-
Sample Request:
axios({
"method": "GET",
"url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "isDone": false, "timeAllocation": 3, "_id": "5e19974bdcc6b7242c12ba38", "title": "First Task", "description": "This is my first task", "dueDate": "2020-01-12T17:00:00.000Z", "user": "5e15fe88d406f210996d4f6d" }
- Code: 200
-
Error Response:
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 401 Unauthorized
Edit a task
-
URL </projects/{id}/tasks/{taskId}>
-
Method:
PUT
-
URL Params
id=[string]
taskId=[string]
-
Request Headers
access_token=[string]
-
Data Params
Optional:title=[string]
description=[string]
dueDate=[date]
timeAllocation=[number]
-
Sample Request:
axios({
"method": "PUT",
"url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
},
"data": {
"title": "Second Task",
"description": "This is my second task",
"timeAllocation": 5,
"dueDate": 2020/01/11
}
})
-
Success Response:
- Code: 200
Content:{ "isDone": false, "timeAllocation": 5, "_id": "5e19974bdcc6b7242c12ba38", "title": "Second Task", "description": "This is my second task", "dueDate": "2020-01-11T17:00:00.000Z", "user": "5e15fe88d406f210996d4f6d" }
- Code: 200
-
Error Response:
- Code: 400 Bad Request
Content:{ error : "Minimum time allocation is 1" }
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 400 Bad Request
Update a task's status
-
URL </projects/{id}/tasks/{taskId}/done>
-
Method:
PATCH
-
URL Params
id=[string]
taskId=[string]
-
Request Headers
access_token=[string]
-
Sample Request:
axios({
"method": "PUT",
"url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/done",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "isDone": done, "timeAllocation": 5, "_id": "5e19974bdcc6b7242c12ba38", "title": "Second Task", "description": "This is my second task", "dueDate": "2020-01-11T17:00:00.000Z", "user": "5e15fe88d406f210996d4f6d" }
- Code: 200
-
Error Response:
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 401 Unauthorized
Delete a task
-
URL </projects/{id}/tasks/{taskId}>
-
Method:
DELETE
-
URL Params
id=[string]
taskId=[string]
-
Request Headers
access_token=[string]
-
Sample Request:
axios({
"method": "DELETE",
"url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
"headers": {
"access_token": "YOUR_ACCESS_TOKEN"
}
})
-
Success Response:
- Code: 200
Content:{ "Task with ID 5e19974bdcc6b7242c12ba38 successfully deleted" }
- Code: 200
-
Error Response:
- Code: 401 Unauthorized
Content:{ error : "Unauthorized process" }
- Code: 404 Not Found
Content:{ error : "Resource not found" }
- Code: 500 Internal Server Error
Content:{ error : error }
- Code: 401 Unauthorized