-
Notifications
You must be signed in to change notification settings - Fork 156
/
apiary.apib
106 lines (77 loc) · 2.43 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
FORMAT: 1A
HOST: http://example.com/
# Exemple PDS
This is the API blueprint of the implementation https://github.com/neich/TODOSpring
## Check user [/users/check]
### Check is user is logged in [GET]
+ Response 200 (application/json)
"ok"
## Login [/users/login]
### Login [POST]
+ Request (application/json)
{
"username": "usuari",
"password": "123456"
}
+ Response 200 (application/json)
+ Body
{
"id": 1,
"username": "usuari",
"email": "[email protected]"
}
## Operations with task collections [/tasks]
### List All Tasks [GET]
+ Response 200 (application/json)
[
{
"id": 1,
"dateCreated": "2018-01-01T00:00:00",
"dateLimit": "2018-03-01T00:00:00",
"completed": false,
"text": "Una tasca"
},
{
"id": 2,
"dateCreated": "2017-01-01T00:00:00",
"dateLimit": "2018-06-01T00:00:00",
"completed": false,
"text": "Una altre tasca"
}
]
### Create a New Task [POST]
+ Request (application/json)
{
"text": "Una tasca",
"dateCreated": "2018-01-01T00:00:00",
"dateLimit": "2018-03-01T00:00:00"
}
+ Response 201 (application/json)
+ Body
{
"id": 1,
"dateCreated": "2018-01-01T00:00:00",
"dateLimit": "2018-03-01T00:00:00",
"completed": false,
"text": "Una tasca"
}
## Get task with id = 1 [/tasks/1]
### Get task with id = 1 [GET]
+ Response 200 (application/json)
{
"id": 1,
"dateCreated": "2018-01-01T00:00:00",
"dateLimit": "2018-03-01T00:00:00",
"completed": false,
"text": "Una tasca"
}
## Get task with id = 3 ERROR [/tasks/3]
### Get task with id = 3 ERROR [GET]
+ Response 500 (application/json)
{
"timestamp": "2019-02-28T19:17:34.311+0000",
"status": 500,
"error": "Internal Server Error",
"message": "No class org.udg.pds.springtodo.entity.Task entity with id 3 exists!",
"path": "/tasks/3"
}