-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apibp
120 lines (77 loc) · 1.93 KB
/
apiary.apibp
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
aFORMAT: 1A
HOST: http://example.com/
# Cats API
Cats is a super simple API of cats and their human owners. Check out docs at: https://app.apiary.io/catsapi1
## User Collection [/user]
### Create a new user [POST /user]
Creates a new user with 0 cats. If no email or name are specified, a 400 error is returned.
+ Request (application/json)
{
"name": "Mike Doe",
"email": "mdoe@example.com"
}
+ Response 200
{
"name": "Mike Doe",
"email": "mdoe@example.com",
"id": 2
}
+ Request (application/json)
{
"email": "mdoe@example.com"
}
+ Response 400
Must send a request body containing user's name and email
+ Request (application/json)
{
"name": "Mike Doe"
}
+ Response 400
Must send a request body containing user's name and email
### Get User Information [GET /user]
Gets the information of the user
+ Response 200
{
"id": 1,
"name": "John Doe",
"email": "jdoe@example.com"
}
## Cat Collection [/cat]
### Create Cat [POST /cat]
Creates a new cat and associates it to the user with ownerId
+ Request (application/json)
{
"name": "Tom",
"ownerId": 1
}
+ Response 200
{
"name": "Tom",
"ownerId": 1,
"id": 2
}
+ Request (application/json)
{
"name": "Tom",
"ownerId": 3
}
+ Response 400
Owner ID 3 does not exist
### Update Cat [PUT /cat/1]
Update the information of an already created cat.
+ Request (application/json)
{
"name": "Tom"
}
+ Response 200
{
"id": 1,
"name": "Tom",
"ownerId": 1
}
+ Request (application/json)
{
"name": "Tom"
}
+ Response 404
Cat not found