-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
455 lines (300 loc) · 13.8 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
FORMAT: 1A
HOST: http://inttest.apiblueprint.org/
# int API
It's Ninja Time application API
## Events Collection [/api/events/{eventid}]
+ Parameters
+ eventid (number) - Unique identifier of the event
### List all events [GET /api/events]
+ Response 200 (application/json)
+ Attributes (EventList)
### Get a single event [GET /api/events/{eventid}]
+ Response 200 (application/json)
+ Attributes (EventDetail)
+ Response 404
### Modify event details [PUT /api/events/{eventid}]
+ Request (application/json)
+ Attributes (EventDetailUpdate)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Start an event [POST /api/events/{eventid}/start]
+ Response 200 (application/json)
+ Attributes (StartStageResponse)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
## Event Obstacle Collection [/api/events/{eventid}/obstacles]
+ Parameters
+ eventid (number) - Unique identifier of the event
### Add an event obstacle [POST /api/events/{eventid}/obstacles]
+ Request (application/json)
+ Attributes (EventObstacleCreate)
+ Response 200 (application/json)
+ Attributes (EventObstacleCreateResponse)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Modify an event obstacle [PUT /api/events/{eventid}/obstacles/{obstacleid}]
+ Parameters
+ obstacleid (number) - Unique identifier of the obstacle
+ Request (application/json)
+ Attributes (EventObstacleModify)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Remove an event obstacle [DELETE /api/events/{eventid}/obstacles/{obstacleid}]
+ Parameters
+ obstacleid (number) - Unique identifier of the obstacle
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
## Event Participant Collection [/api/events/{eventid}/participants]
+ Parameters
+ eventid (number) - Unique identifier of the event
### Add an event participant [POST /api/events/{eventid}/participants]
+ Request (application/json)
+ Attributes (EventParticipantCreate)
+ Response 200 (application/json)
+ Attributes (EventParticipantCreateResponse)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Modify an event participant [PUT /api/events/{eventid}/participants/{participantid}]
+ Parameters
+ participantid (number) - Unique identifier of the participant in the event
+ Request (application/json)
+ Attributes (EventParticipantModify)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Remove an event participant [DELETE /api/events/{eventid}/participants/{participantid}]
+ Parameters
+ participantid (number) - Unique identifier of the participant in the event
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
## Stages Collection [/api/events/{eventid}/stages/{stageid}]
+ Parameters
+ eventid (number) - Unique identifier of the event
+ stageid (number) - Unique identifier of the stage
### Get a single stage [GET /api/events/{eventid}/stages/{stageid}]
+ Response 200 (application/json)
+ Attributes (StageDetail)
+ Response 404
### Get missing participants [GET /api/events/{eventid}/stages/{stageid}/missingparticipants]
+ Response 200 (application/json)
+ Attributes (StageMissingParticipants)
+ Response 404
### Add a stage [POST /api/events/{eventid}/stages]
API will automatically create, order, and name the stage based on standards.
+ Response 200 (application/json)
+ Attributes (EventStage)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Modify a stage [PUT /api/events/{eventid}/stages/{stageid}]
+ Request (application/json)
+ Attributes (EventStageModify)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Remove a stage [DELETE /api/events/{eventid}/stages/{stageid}]
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### End a live stage [POST /api/events/{eventid}/stages/{stageid}/finish]
+ Request (application/json)
+ Attributes (EndStageParticipantList)
+ Response 200 (application/json)
+ Attributes (StartStageResponse)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Reorder upcoming runs in a live stage [POST /api/events/{eventid}/stages/{stageid}/order]
+ Request (application/json)
+ Attributes (StageReorderRequest)
+ Response 200 (application/json)
+ Attributes (StageDetail)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
## Stage Obstacles Collection [/api/events/{eventid}/stages/{stageid}/obstacles]
+ Parameters
+ eventid (number) - Unique identifier of the event
+ stageid (number) - Unique identifier of the stage
### List all stage obstacles [GET /api/events/{eventid}/stages/{stageid}/obstacles]
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (StageObstacleList)
+ Response 404
### Add obstacle to stage [POST /api/events/{eventid}/stages/{stageid}/obstacles]
+ Request (application/json)
+ Attributes (StageObstacleAdd)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Modify obstacle order in stage [PUT /api/events/{eventid}/stages/{stageid}/obstacles/{obstacleid}]
+ Parameters
+ obstacleid (number) - Unique identifier of the obstacle in this event
+ Request (application/json)
+ Attributes (StageObstacleReorder)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Remove stage obstacle [DELETE /api/events/{eventid}/stages/{stageid}/obstacles/{obstacleid}]
+ Parameters
+ obstacleid (number) - Unique identifier of the obstacle in this event
+ Response 200 (application/json)
+ Attributes (StageObstacleList)
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
## Stage Results Collection [/api/events/{eventid}/stages/{stageid}/results]
+ Parameters
+ eventid (number) - Unique identifier of the event
+ stageid (number) - Unique identifier of the stage
### List current stage results [GET /api/events/{eventid}/stages/{stageid}/results]
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (EventStageResultList)
+ Response 404
### Record a single stage result [POST /api/events/{eventid}/stages/{stageid}/results/{runid}]
+ Parameters
+ runid (number) - Unique identifier of this run result
+ Request (application/json)
+ Attributes (RecordStageResult)
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
### Remove a single stage result [DELETE /api/events/{eventid}/stages/{stageid}/results/{runid}]
+ Parameters
+ runid (number) - Unique identifier of this run result
+ Response 204
+ Response 400 (application/json)
+ Attributes (Error400)
+ Response 404
# Data Structures
## EventList (object)
- Events (array[EventSummary])
## EventSummary (object)
- EventId: 5 (number) - Unique Id of the event
- Name: `Sample Ninja Event` (string) - Viewed name of event
- StartDate: `2018-10-10 9:00 am` (string) - Date and time when the event starts
- Location: `Sample Location` (string) - Free text location description
- Description: `Sample Description` (string) - Free text to describe anything else about your event
- ParticipantCount: 20 (number) - How many participants we currently have
- StageCount: 4 (number) - Total count of stages
- ActiveStageId: 9 (number) - Unique Id of the active stage. First stage if event is to come. Null if unstarted or done - see also Completed
- ActiveStageName: `Stage 1` (string) - Name of the ActiveStageId or blank
- Completed: false (boolean) - Has the event been completed?
## EventDetail (object)
- EventSummary (EventSummary)
- ParticipantList (array[EventParticipant])
- StageList (array[EventStage])
- ObstacleList (array[EventObstacle])
## EventDetailUpdate (object)
- Name: `Sample Ninja Event` (string) - Viewed name of event
- StartDate: `2018-10-10 9:00 am` (string) - Date and time when the event starts
- Location: `Sample Location` (string) - Free text location description
- Description: `Sample Description` (string) - Free text to describe anything else about your event
## EventParticipant (object)
- ParticipantId: 4 (number) - Unique Id of the participant in this event
- Name: `Don Thompson` (string) - Name of participant
## StageDetail (object)
- Details (EventStage)
- ObstacleList (array[StageObstacle])
- UpcomingList (array[UpcomingRun])
- FinishedList (array[FinishedRun])
## EventStage (object)
- StageId: 9 (number) - Unique Id of the stage
- StageName: `Stage 1` (string) - Name of the stage. Typically Stage 1, Stage 2, etc.
- StageOrder: 1 (number) - Numeric order of the stages in the event
- PointsBased: true (boolean) - Is this a points based stage?
- EventId: 5 (number) - Unique Id of the event this stage is part of
- EventName: `Sample Ninja Event` (string) - Viewed name of the event this stage is part of
- ObstacleCount: 6 (number) - Count of obstacles assigned to this stage
- IsLastStage: false (boolean) - Is this the last stage in the event?
## EventObstacle (object)
- ObstacleId: 13 (number) - Unique Id of this obstacle
- Name: `Warped Wall` (string) - Name of this obstacle
- Description: `A very tall curved wall` (string) - A description of the obstacle
## StageObstacle (object)
- ObstacleId: 13 (number) - Unique Id of this obstacle
- Name: `Warped Wall` (string) - Name of this obstacle
- Order: 1 (number) - Unique Id of the stage this obstacle is part of
- Description: `A very tall curved wall` (string) - A description of the obstacle
## UpcomingRun (object)
- RunId: 1 (number) - Unique Id of this run
- Participant (EventParticipant) - The participant details
- RunOrder: 6 (number) - Order of this run in the stage - ordered from the beginning of the stage, not the remaining
## RunResultSummary (object)
- NumObstaclesCompleted: 6 (number) - Count of obstacles passed in this result
- RunTime: 84.15 (number) - Total run time to success or failure in seconds. May include decimal seconds
## FinishedRun (object)
- RunId: 1 (number) - Unique Id of this run
- Participant (EventParticipant) - The participant details
- RunOrder: 6 (number) - Order of this run in the stage - ordered from the beginning of the stage, not the remaining
- Result (RunResultSummary) - Time and number of obstacles finished
## StageResult (object)
- RunId: 42 (number) - Unique Id of this result among all results
- Participant (EventParticipant) - The participant details
- RunOrder: 6 (number) - Order of this run in the stage
- Place: 3 (number) - Finishing place in this stage. Ordered by number completed descending then time ascending
- Result (RunResultSummary) - Time and number of obstacles finished
## Error400 (object)
- Message: `An error has occurred` (string)
## EventParticipantCreate (object)
- Name: `Don Thompson` (string) - Name of the participant
## EventParticipantModify (object)
- Name: `Don Thompson` (string) - Name of the participant
## EventParticipantCreateResponse (object)
- Participant (EventParticipant)
## EventObstacleCreate (object)
- Name: `Warped Wall` (string) - Short name of the obstacle
- Description: `A very tall curved wall` (string) - A description of the obstacle
## EventObstacleModify (object)
- Name: `Warped Wall` (string) - Short name of the obstacle
- Description: `A very tall curved wall` (string) - A description of the obstacle
## EventObstacleCreateResponse (object)
- Obstacle (EventObstacle)
## EventStageModify (object)
- Name: `Stage 1` (string) - Name of the stage. Typically Stage 1, Stage 2, etc. Leave null if you do not want to change.
- NewOrder: 1 (number) - New order of the stage if you want to re-order them. Leave null if you do not want to change.
- PointsBased: true (boolean) - Is this stage scored via points?
## StageObstacleList (object)
- ObstacleList (array[StageObstacle])
## StageObstacleAdd (object)
- ObstacleId: 13 (number) - Unique Id of the event obstacle to add to the stage
## StageObstacleReorder (object)
- NewOrder: 3 (number) - New order of this obstacle in the stage. The old obstacle at this position and all other are pushed down by one. First obstacle is 1.
## StartStageResponse (object)
- StageId: 1 (number) - The unique identifier of the stage now active for this event.
## EndStageParticipantList (object)
- ParticipantList (array[number]) - An array of EventParticipant unique identifiers for the participants who will move on to the next stage. When finishing the last stage, this value will be ignored and can be null.
## EventStageResultList (object)
- Details (EventStage)
- ResultList (array[StageResult])
## StageReorderRequest (object)
- Method: 'random' (string) - String of the method to use in reordering. Reorders only apply to participants not yet finished. Options are: 'random', 'first', 'reverse', 'manual'
- ParticipantList (array[number]) - Only used if method is 'manual'. An ordered array of event participant ids to cause a re-order for the event. Will ignore any changes to participants with results for this stage.
## ObstacleResult (object)
- ObstacleId: 9 (number) - Unique identifier of the obstacle in the stage
- Attempted: true (boolean) - Was the obstacle attempted?
- Completed: true (boolean) - Was the obstacle completed successfully?
- TimeToFinish: 84.15 (number) - Time in seconds to complete this obstacle since the beginning of the run. Timed in fractional seconds.
## RecordStageResult (object)
- StartLocalTime: `2018-10-10 10:13:28 am` - Local time from the timing device when the run started.
- ObstacleResultList (array[ObstacleResult]) - Array of results for each obstacle in the stage
## StageMissingParticipants (object)
- ParticipantList (array[EventParticipant])