-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapiary.apib
322 lines (230 loc) · 8.1 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
FORMAT: 1A
# RetroGames
This documents our RESTful API for our Retro Games Database.
We separated our HTML returns and our JSON returns by prepending /api
Example: API endpoint for '/people' would be '/api/people'.
POST requests are used to create, while PUT requests are used to update endpoints.
HTTP status codes as stated below are expected to be followed:
- 200 `OK` - the request was successful (some API calls may return 201 instead).
- 201 `Created` - the request was successful and a resource was created.
- 204 `No Content` - the request was successful but there is no representation to return (i.e. the response is empty).
- 400 `Bad Request` - the request could not be understood or was missing required parameters.
- 401 `Unauthorized` - authentication failed or user doesn't have permissions for requested operation.
- 403 `Forbidden` - access denied.
- 404 `Not Found` - resource was not found
- 405 `Method Not Allowed` - requested method is not supported for resource.
# Group Games
## Game Collection [/api/games]
### List all games [GET]
+ Response 200 (application/json)
[{
"name": "Metroid",
"id": 1,
"system": "NES",
}]
### Add a game [POST]
+ Request (application/json)
{
"name": "Metroid",
"system": "NES",
"release_date": "1986-08-06",
"genre": ["action-adventure", "side-scroller"],
"synopsis": "Long text describing Metroid",
"copies_sold": 2730000,
"images": ["http://upload.wikimedia.org/wikipedia/en/5/5d/Metroid_boxart.jpg"],
"gameFAQ" : "http://www.gamefaqs.com/nes/519689-metroid",
"videos": ["https://www.youtube.com/watch?v=WT4pW6n7-rg"],
"people": [1],
"companies": [1],
}
+ Response 201 (application/json)
{ "id": 1 }
## Game [/api/games/{id}]
### Get info for a specific game [GET]
+ Response 200 (application/json)
{
"name": "Metroid",
"id": 1,
"system": "NES",
"release_date": "1986-08-06",
"genre": ["action-adventure", "side-scroller"],
"synopsis": "Long text describing Metroid",
"copies_sold": 2730000,
"images": ["http://upload.wikimedia.org/wikipedia/en/5/5d/Metroid_boxart.jpg"],
"gameFAQ" : "http://www.gamefaqs.com/nes/519689-metroid",
"videos": ["https://www.youtube.com/watch?v=WT4pW6n7-rg"],
"people": [1],
"companies": [1],
}
### Update an existing game [PUT]
+ Request (application/json)
{
"name": "Metroid",
"system": "NES",
"release_date": "1986-08-06",
"genre": ["action-adventure", "side-scroller"],
"synopsis": "Long text describing Metroid",
"copies_sold": 2730000,
"images": ["http://upload.wikimedia.org/wikipedia/en/5/5d/Metroid_boxart.jpg"],
"gameFAQ" : "http://www.gamefaqs.com/nes/519689-metroid",
"videos": ["https://www.youtube.com/watch?v=WT4pW6n7-rg"],
"people": [1],
"companies": [1],
}
+ Response 204
### Delete an existing game [DELETE]
+ Response 204
## Company info relating to a specific game [/api/games/{id}/companies]
### List all related companies [GET]
+ Response 200 (application/json)
[{
"name": "Nintendo",
"id": 1,
}]
## List all related people [/api/games/{id}/people]
### List all related people [GET]
+ Response 200 (application/json)
[{
"name": "Yoshio Sakamoto",
"id": 1,
"job": "Director",
}]
# Group People
## People Collection [/api/people]
### List all people in the database [GET]
+ Response 200 (application/json)
[{
"name": "Yoshio Sakamoto",
"id": 1,
"job": {1: "Director"},
}]
### Add a person [POST]
+ Request (application/json)
{
"name": "Yoshio Sakamoto",
"DOB": "1959-07-23",
"location": "Kyoto, Japan",
"job": {1: "Director"},
"description": "Long text description for Yoshio",
"images": ["http://upload.wikimedia.org/wikipedia/commons/3/3d/Yoshio_Sakamoto_-_Game_Developers_Conference_2010_-_Day_3_%282%29_cropped.jpg"],
"videos": ["https://www.youtube.com/watch?v=eBuWOKsK2JE"],
"games": [1],
"companies": [1],
}
+ Response 201 (application/json)
{ "id": 1 }
## People [/api/people/{id}]
### Get info for a specific person [GET]
+ Response 200 (application/json)
{
"name": "Yoshio Sakamoto",
"id": 1,
"DOB": "1959-07-23",
"location": "Kyoto, Japan",
"job": {1: "Director"},
"description": "Long text description for Yoshio",
"images": ["http://upload.wikimedia.org/wikipedia/commons/3/3d/Yoshio_Sakamoto_-_Game_Developers_Conference_2010_-_Day_3_%282%29_cropped.jpg"],
"videos": ["https://www.youtube.com/watch?v=eBuWOKsK2JE"],
"games": [1],
"companies": [1],
}
### Update an existing person [PUT]
+ Request (application/json)
{
"name": "Yoshio Sakamoto",
"DOB": "1959-07-23",
"location": "Kyoto, Japan",
"job": {1: "Director"},
"description": "Long text description for Yoshio",
"images": ["http://upload.wikimedia.org/wikipedia/commons/3/3d/Yoshio_Sakamoto_-_Game_Developers_Conference_2010_-_Day_3_%282%29_cropped.jpg"],
"videos": ["https://www.youtube.com/watch?v=eBuWOKsK2JE"],
"games": [1],
"companies": [1],
}
+ Response 204
### Delete an existing person [DELETE]
+ Response 204
## Game info for a person [/api/people/{id}/games]
### List all related games [GET]
+ Response 200 (application/json)
[{
"name": "Metroid",
"id": 1,
"system": "NES",
}]
## Company info for a person [/api/people/{id}/companies]
### List all related companies [GET]
+ Response 200 (application/json)
[{
"name": "Nintendo",
"id": 1,
}]
# Group Companies
## Companies Collection [/api/companies]
### List all companies in the database [GET]
+ Response 200 (application/json)
[{
"name": "Nintendo",
"id": 1,
}]
### Add a company [POST]
+ Request (application/json)
{
"name": "Nintendo",
"founded": "1889",
"location": "Kyoto, Japan",
"description": "Long text description for Nintendo",
"images": ["http://ugrgaming.com/wp-content/uploads/2013/01/Nintendo-Logo.jpg"],
"map": ["http://goo.gl/maps/1KSBf"],
"external_links": ["http://www.nintendo.com/"],
"people": [1],
"games": [1],
}
+ Response 201 (application/json)
{ "id": 1 }
## Companies [/api/companies/{id}]
### Get info for a specific company [GET]
+ Response 200 (application/json)
{
"name": "Nintendo",
"id": 1,
"founded": "1889",
"location": "Kyoto, Japan",
"description": "Long text description for Nintendo",
"images": ["http://ugrgaming.com/wp-content/uploads/2013/01/Nintendo-Logo.jpg"],
"map": ["http://goo.gl/maps/1KSBf"],
"external_links": ["http://www.nintendo.com/"],
"people": [1],
"games": [1],
}
### Update an existing company [PUT]
+ Request (application/json)
{
"name": "Nintendo",
"founded": "1889",
"location": "Kyoto, Japan",
"description": "Long text description for Nintendo",
"images": ["http://ugrgaming.com/wp-content/uploads/2013/01/Nintendo-Logo.jpg"],
"map": ["http://goo.gl/maps/1KSBf"],
"external_links": ["http://www.nintendo.com/"],
"people": [1],
"games": [1],
}
+ Response 204
### Delete an existing organization [DELETE]
+ Response 204
## Game info for a Company [/api/companies/{id}/games]
### List all related games [GET]
+ Response 200 (application/json)
[{
"name": "Metroid",
"id": 1,
"system": "NES",
}]
## People info for a Company [/api/companies/{id}/people]
### List all related people [GET]
+ Response 200 (application/json)
[{
"name": "Yoshio Sakamoto",
"id": 1,
}]