one more todo list implementation - university project
Each todolist consists of a title field and a list of tasks.
Each task consists of a title field and a description field.
API is based on vnd.api+json.
REQUEST:
GET /justdoit
RESPONSE:
Content-Type: application/json
{
"_links": {
"todolists": { "href": "/justdoit/todolists" },
},
}
REQUEST:
GET /justdoit/todolists
Accept: application/vnd.api+json
RESPONSE:
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "todolist id",
"type": "todolist",
"attributes": { "title": "title of the todolist", },
"links": { "self: { "href": "/justdoit/todolists/{id} } },
},
],
}
REQUEST:
GET /justdoit/todolists/{id}
Accept: application/vnd.api+json
RESPONSE:
Content-Type: application/vnd.api+json
{
"data": {
"id": "1",
"type": "todolist",
"attributes": { "title": "title of the todolist", },
"relationships": {
"tasks": {
"links": {
"related": {
"href": "/justdoit/todolists/{id}/tasks",
},
},
},
},
},
"links": { "self": { "href": "/justdoit/todolists/{id}" }, },
}
REQUEST:
POST /justdoit/todolists
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
{
"data": {
"type": "todolist",
"attributes": { "title": "title of the todolist", },
},
}
RESPONSE:
HTTP/1.1 201 Created
Location: /justdoit/todolists/{id}
REQUEST:
DELETE /justdoit/todolists/{id}
RESPONSE:
HTTP/1.1 200 OK
REQUEST:
GET /justdoit/todolists/{id}/tasks
Accept: application/vnd.api+json
RESPONSE:
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "task id",
"type": "task",
"attributes": {
"title": "title of the task",
"description": "description of the task",
},
"links": { "self": { "href": "/justdoit/todolists/{id}/tasks/{taskId}" } },
},
],
"links": { "self": { "href": "/justdoit/todolists/{id}" }, },
}
REQUEST:
POST /justdoit/todolists/{id}/tasks
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
{
"data": {
"type": "task",
"attributes": {
"title": "title of the task",
"description": "description of the task",
},
}
}
RESPONSE:
HTTP/1.1 201 Created
Location: /justdoit/todolists/{id}/tasks/{taskId}
REQUEST:
DELETE /justdoit/todolists/{id}/tasks/{taskId}
RESPONSE:
HTTP/1.1 200 OK
REQUEST:
PATCH /justdoit/todolists/{id}/tasks/{taskId}
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
{
"data": {
"id": "taskId",
"type": "task",
"attributes": { "description": "new description here", },
},
}
RESPONSE:
HTTP/1.1 200 OK
REQUEST:
PATCH /justdoit/todolists/{id}
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
{
"data": {
"id": "todolist id",
"type": "todolist",
"attributes": { "title": "new title here", },
}
}
RESPONSE:
HTTP/1.1 200 OK