· 6 years ago · Oct 17, 2019, 09:20 PM
1FORMAT: 1A
2HOST: https://raceready.dev.shio.co/api/v1/
3
4# RaceReady
5
6This is the documentation for the RaceReady API
7
8# Usage and Notes
9
10##Authorization
11When authorization is required:
12
13* Calling the users/login method will return a token.
14* Token should be sent as Bearer type
15* The token will expire 1 year after being created.
16
17##API Versioning
18The url will have the version included (Currently /v1).
19
20##HTTP Response Codes & Errors
21This API uses conventional HTTP response codes to indicate the success or failure of a request.
22
23| Status | Explanation |
24|---|---|
25| 2xx | Success |
26| 200 | Ok. Everything worked as expected with content returned. |
27| 201 | Ok. New record created. |
28| 202 | Accepted. Everything worked and the system is processing the request. |
29| 204 | No Content. Everything worked as expected without content returned. |
30| 400 | Bad Request. This means a required parameter was missing request failed validation. |
31| 401 | Unauthorized. Access token not provided, or not allowed to access resource. |
32| 404 | Not Found. Invalid item/id/URL requested. |
33| 409 | Conflict. An object with the given attributes already exists. |
34| 5xx | Server error. Something on our end is wrong. |
35
36
37For anything that's not in the 200's an error array will be returned.
38
39```
40{
41 "errors": {
42 {
43 "field_name": [
44 "The field_name is required."
45 ],
46 "field_name_2": [
47 "The field_name_2 is required."
48 ],
49 "detail":"Sorry, that user does not exist.",
50 "status":404
51 }
52 }
53}
54```
55
56# Group Users
57
58## Users [/users]
59
60### Create a New Racer [POST]
61- Request (application/json)
62 - Headers
63
64 X-Requested-With: XMLHttpRequest
65
66 - Attributes (NewRacerStore)
67
68- Response 201 (application/json)
69 - Attributes(NewUserResponse)
70
71
72### Create a New Guardian [POST]
73- Request (application/json)
74 - Headers
75
76 X-Requested-With: XMLHttpRequest
77
78 - Attributes (NewGuardianStore)
79
80- Response 201 (application/json)
81 - Attributes(NewUserResponse)
82
83
84### Create a New Manager [POST]
85- Request (application/json)
86 - Headers
87
88 X-Requested-With: XMLHttpRequest
89
90 - Attributes (NewManagerStore)
91
92- Response 201 (application/json)
93 - Attributes(NewUserResponse)
94
95
96### Create a New Promoter Admin [POST]
97- Request (application/json)
98 - Headers
99
100 X-Requested-With: XMLHttpRequest
101
102 - Attributes (NewPromoterAdminStore)
103
104- Response 201 (application/json)
105 - Attributes(NewUserResponse)
106
107
108
109## Login [/users/login]
110
111### Get Racer Login Token [POST]
112- Request (application/json)
113 - Headers
114
115 X-Requested-With: XMLHttpRequest
116
117 - Attributes
118 - email: `testracer@example.com` (string, required)
119 - password: `password` (string, required)
120
121- Response 200 (application/json)
122 - Attributes (OAuth valid response)
123
124
125### Get Guardian Login Token [POST]
126- Request (application/json)
127 - Headers
128
129 X-Requested-With: XMLHttpRequest
130
131 - Attributes
132 - email: `testguardian@example.com` (string, required)
133 - password: `password` (string, required)
134
135- Response 200 (application/json)
136 - Attributes (OAuth valid response)
137
138
139### Get Manager Login Token [POST]
140- Request (application/json)
141 - Headers
142
143 X-Requested-With: XMLHttpRequest
144
145 - Attributes
146 - email: `testmanager@example.com` (string, required)
147 - password: `password` (string, required)
148
149- Response 200 (application/json)
150 - Attributes (OAuth valid response)
151
152
153### Get Promoter Admin Login Token [POST]
154- Request (application/json)
155 - Headers
156
157 X-Requested-With: XMLHttpRequest
158
159 - Attributes
160 - email: `testpromoteradmin@example.com` (string, required)
161 - password: `password` (string, required)
162
163- Response 200 (application/json)
164 - Attributes (OAuth valid response)
165
166
167## Particular User [/users/{user_id}]
168- Parameters
169 - user_id: 6 (number, required) - Id of a User
170
171### Update User [PATCH]
172- Request (application/json)
173 - Headers
174
175 Authorization: Bearer JWT
176 X-Requested-With: XMLHttpRequest
177
178 - Attributes
179 - first_name: `Bob` (string, optional)
180 - last_name: `Smith` (string, optional)
181 - email: `racer@example.com` (string, optional)
182 - avatar_image (optional) - File of avatar image
183 - media_id (number, optional) - id of media_id
184 - password: `password` (string, optional)
185 - dob: `2018-01-01` (string, optional) - required if we do not have for this user yet
186 - gender: `male` (string, optional) - required if we do not have for this user yet
187 - phone: `555-555-55555` (string, optional) - required if we do not have for this user yet
188 - address: `123 Some Street` (string, optional) - required if we do not have for this user yet
189 - city: `Salt Lake City` (string, optional) - required if we do not have for this user yet
190 - state_id: 46 (number, optional) - required if we do not have for this user yet
191 - zip: `84111` (string, optional) - required if we do not have for this user yet
192 - bikes (array, nullable, optional)
193 - (object)
194 - id (optional) - Id if we're updating a bike
195 - number: `xyz123` (string, required) - Bike number
196 - brand_id: 1 (number, required) - Id of bike brand
197 - engine_size_id: 1 (number, required) - Id of engine size
198 - vin: `123xyz` (string, optional, nullable)
199 - sponsors (array, nullable, optional)
200 - (object)
201 - name: `Foo Sponsor` (string) - Name of sponsor
202 - relationships (array, nullable, optional)
203 - (object)
204 - relation: `manager` (required, string) - String either: manager or guardian
205 - user_id: 7 (required, number) - Id of manager or guardian
206
207- Response 200 (application/json)
208
209 - Attributes (CurrentUserResponse)
210
211
212
213## Particular User's Series [/users/{user_id}/series/]
214- Parameters
215 - user_id: 1 (number, required) - Id of a User
216
217### Get Series [GET]
218- Request (application/json)
219 - Headers
220
221 Authorization: Bearer JWT
222 X-Requested-With: XMLHttpRequest
223
224- Response 200 (application/json)
225 - Attributes (array[SeriesResponse])
226
227
228## Particular User's Events [/users/{user_id}/events/]
229- Parameters
230 - user_id: 2 (number, required) - Id of a User
231
232### Get Events [GET]
233- Request (application/json)
234 - Headers
235
236 Authorization: Bearer JWT
237 X-Requested-With: XMLHttpRequest
238
239- Response 200 (application/json)
240 - Attributes (array[EventResponse])
241
242## Particular User's Created Memberships [/users/{user_id}/memberships_created]
243- Parameters
244 - user_id: 2 (number, required) - Id of a User
245
246### Get Created Memberships [GET]
247- Request (application/json)
248 - Headers
249
250 Authorization: Bearer JWT
251 X-Requested-With: XMLHttpRequest
252
253- Response 200 (application/json)
254 - Attributes (array[MembershipResponse])
255
256## Current User [/users/me]
257### Get Current User [GET]
258- Request (application/json)
259 - Headers
260
261 Authorization: Bearer JWT
262 X-Requested-With: XMLHttpRequest
263
264- Response 200 (application/json)
265 - Attributes (CurrentUserResponse)
266
267
268# Group Bikes
269## Bike [/users/{user_id}/bikes/]
270- Parameters
271 - user_id: 6 (number, required) - Id of a User
272
273### Add New Bike [POST]
274- Request (application/json)
275 - Headers
276
277 Authorization: Bearer JWT
278 X-Requested-With: XMLHttpRequest
279
280 - Attributes
281 - number: `x-012` (string, required)
282 - brand_id: 1 (number, required)
283 - engine_size_id: 1 (number, required)
284 - vin: `123456789` (string, optional)
285
286- Response 201 (application/json)
287 - Attributes (BikeResponse)
288
289
290### Get Users Bikes [GET]
291- Request (application/json)
292 - Headers
293
294 Authorization: Bearer JWT
295 X-Requested-With: XMLHttpRequest
296
297- Response 200 (application/json)
298 - Attributes (array[BikeResponse])
299
300
301## Certain Bike [/users/{user_id}/bikes/{bike_id}]
302- Parameters
303 - user_id: 6 (number, required) - Id of a User
304 - bike_id: 1 (number, required) - Id of a Bike
305
306### Get a Bike [GET]
307- Request (application/json)
308 - Headers
309
310 X-Requested-With: XMLHttpRequest
311
312- Response 200 (application/json)
313 - Attributes (BikeResponse)
314
315
316### Update a Bike [PATCH]
317- Request (application/json)
318 - Headers
319
320 Authorization: Bearer JWT
321 X-Requested-With: XMLHttpRequest
322
323 - Attributes
324 - number: `x-012` (string, required)
325 - brand_id: 1 (number, required)
326 - engine_size_id: 1 (number, required)
327 - vin: `123456789` (string, optional, nullable)
328
329- Response 200 (application/json)
330 - Attributes (BikeResponse)
331
332
333### Delete a Bike [DELETE]
334- Request (application/json)
335 - Headers
336
337 Authorization: Bearer JWT
338 X-Requested-With: XMLHttpRequest
339
340- Response 204
341
342
343# Group Memberships
344## Memberships [/memberships]
345### Add New Membership [POST]
346- Request (application/json)
347 - Headers
348
349 Authorization: Bearer JWT
350 X-Requested-With: XMLHttpRequest
351
352 - Attributes
353 - `name`: `Foo Membership` (string, required)
354 - `days_valid`: `5` (number, optional) - Required without sending end_date
355 - `end_date`: `2020-01-01` (string, optional) - Required without sending days_valid
356 - price: 20 (number, required)
357 - forward_fees_id: 1 (optional, number) - ID of user to forward fees to
358 - forward_fees_custom: foo custom (optional, string) - String to id who fees are forwarded to
359
360- Response 201 (application/json)
361 - Attributes (MembershipResponse)
362
363
364### Add New Membership [POST]
365- Request (application/json)
366 - Headers
367
368 Authorization: Bearer JWT
369 X-Requested-With: XMLHttpRequest
370
371 - Attributes
372 - `name`: `Bar Membership` (string, required)
373 - `days_valid`: `8` (number, optional) - Required without sending end_date
374 - `end_date`: `2020-01-01` (string, optional) - Required without sending days_valid
375 - price: 20 (number, required)
376 - forward_fees_id: 1 (optional, number) - ID of user to forward fees to
377 - forward_fees_custom: bar custom (optional, string) - String to id who fees are forwarded to
378
379- Response 201 (application/json)
380 - Attributes (MembershipResponse)
381
382
383### Get Memberships Created by Logged In User [GET]
384- Request (application/json)
385 - Headers
386
387 Authorization: Bearer JWT
388 X-Requested-With: XMLHttpRequest
389
390- Response 200 (application/json)
391 - Attributes (array[MembershipResponse])
392
393
394## Certain Membership [/memberships/{membership_id}]
395- Parameters
396 - membership_id: 1 (number, required) - Id of a membership
397### Get a Membership [GET]
398- Request (application/json)
399 - Headers
400
401 X-Requested-With: XMLHttpRequest
402
403- Response 200 (application/json)
404 - Attributes (MembershipResponse)
405
406
407# Group Waivers
408## Waivers [/waivers]
409### Add New Waiver [POST]
410- Request (application/json)
411 - Headers
412
413 Authorization: Bearer JWT
414 X-Requested-With: XMLHttpRequest
415
416 - Attributes
417 - name: `Foo Waiver` (string, required)
418 - text: `Foo Waiver text to display to user.` (string, required)
419
420- Response 201 (application/json)
421 - Attributes (SponsorResponse)
422
423
424# Group Series
425## Default Background Images [/series/defaultbackgroundimages]
426### Get Series Default Background Images [GET]
427- Request (application/json)
428 - Headers
429
430 X-Requested-With: XMLHttpRequest
431
432- Response 200 (application/json)
433 - Attributes (array[SpatieImageResponse])
434
435
436## Series [/series]
437### Get Future Series [GET]
438
439+ Request (application/json)
440
441+ Response 200 (application/json)
442 + Attributes (array[SeriesResponse])
443
444
445### Add New Series [POST]
446- Request (application/json)
447 - Headers
448
449 Authorization: Bearer JWT
450 X-Requested-With: XMLHttpRequest
451
452 - Attributes
453 - name: `series_name` (string, required)
454 - is_published: true (boolean, optional) - Defaults to true
455 - `host_name`: `host_name` (string, required)
456 - start_date: `2018-01-01` (string, required)
457 - end_date: `2018-01-02` (string, required)
458 - event_ids (optional, array)
459 - background_image (string, optional) - Actually a file type. Required if background_image_id is not provided
460 - background_image_id: 1 (number, optional) - Required if background_image is not provided
461
462- Response 201 (application/json)
463 - Attributes (SeriesResponse)
464
465
466## Certain Series [/series/{series_id}]
467- Parameters
468 - series_id: 2 (number, required) - Id of a series
469
470### Update a Series [POST]
471- Request (application/json)
472 - Headers
473
474 Authorization: Bearer JWT
475 X-Requested-With: XMLHttpRequest
476
477 - Attributes
478 - name: `series_name` (string)
479 - is_published: true (boolean, optional)
480 - `host_name`: `host_name` (string)
481 - start_date: `2018-01-01` (string)
482 - end_date: `2018-01-02` (string)
483 - background_image (string, optional) - Actually a file type. Required if background_image_id is not provided
484 - background_image_id: 1 (number, optional) - Required if background_image is not provided
485
486- Response 200 (application/json)
487 - Attributes (SeriesResponse)
488
489##Season Pass [/series/{series_id}/season_passes]
490- Parameters
491 - series_id: 1 (number, required) - Id of a series
492
493### Add Series Season Pass [POST]
494- Request (application/json)
495 - Headers
496
497 Authorization: Bearer JWT
498 X-Requested-With: XMLHttpRequest
499
500 - Attributes
501 - `name`: `Foo pass` (string, required)
502 - price: 20 (number, required)
503 - limit: 2 (number, required)
504 - `num_available`: 4 (number, required)
505 - covers_pro_classes: false (boolean, optional)
506
507- Response 201 (application/json)
508 - Attributes (EventResponse)
509
510# Group Default Race Classes
511## Default Race Classes [/classes]
512### Add New Default Race Class [POST]
513- Request (application/json)
514 - Headers
515
516 Authorization: Bearer JWT
517 X-Requested-With: XMLHttpRequest
518
519 - Attributes
520 - name: `Foo Event` (string, required)
521 - `min_age`: 10 (number, required)
522 - `max_age`: 15 (number, required)
523 - `skill_level_id`: 1 (number, required)
524 - `default_age_marker`: calendar_year (string, required)
525 - `default_discount_exempt` (boolean)
526 - `default_price` (number)
527 - category_ids (array, optional)
528
529- Response 201 (application/json)
530 - Attributes (DefaultRaceClassResponse)
531
532
533# Group Locations
534## Locations [/locations]
535### Get Logged in User's Locations [GET]
536- Request (application/json)
537 - Headers
538
539 Authorization: Bearer JWT
540 X-Requested-With: XMLHttpRequest
541
542- Response 200 (application/json)
543 - Attributes (array[LocationResponse])
544
545### Add New Location [POST]
546- Request (application/json)
547 - Headers
548
549 Authorization: Bearer JWT
550 X-Requested-With: XMLHttpRequest
551
552 - Attributes
553 - name: `series_name` (string, required)
554 - address: `123 Street` (string, required)
555 - city: `Foo City` (string, required)
556 - state_id: 1 (number, required)
557 - zip: `Foo zip` (string, required)
558 - lat: 11.1 (number, required)
559 - long: 12.1 (number, required)
560
561- Response 201 (application/json)
562 - Attributes (LocationResponse)
563
564
565## Certain Location [/locations/{location_id}]
566- Parameters
567 - location_id: 5 (number, required) - Id of a location
568### Get a Location [GET]
569- Request (application/json)
570 - Headers
571
572 X-Requested-With: XMLHttpRequest
573
574- Response 200 (application/json)
575 - Attributes (LocationResponse)
576
577
578### Update a Location [POST]
579- Request (application/json)
580 - Headers
581
582 X-Requested-With: XMLHttpRequest
583
584 - Attributes
585 - name: `series_name` (string, required)
586 - address: `124 Street` (string, required)
587 - city: `Foo City` (string, required)
588 - state_id: 1 (number, required)
589 - zip: `Foo zip` (string, required)
590 - lat: 11.1 (number, required)
591 - long: 12.1 (number, required)
592
593- Response 200 (application/json)
594 - Attributes (LocationResponse)
595
596
597### Delete Location [DELETE]
598- Request (application/json)
599 - Headers
600
601 Authorization: Bearer JWT
602 X-Requested-With: XMLHttpRequest
603
604- Response 204
605
606
607# Group Events
608## Default Background Images [/events/defaultbackgroundimages]
609### Get Events Default Background Images [GET]
610- Request (application/json)
611 - Headers
612
613 X-Requested-With: XMLHttpRequest
614
615- Response 200 (application/json)
616 - Attributes (array[SpatieImageResponse])
617
618
619## Events [/events]
620### Get Future Events [GET]
621
622+ Request (application/json)
623
624+ Response 200 (application/json)
625 + Attributes (array[EventResponse])
626
627
628### Add New Event [POST]
629- Request (application/json)
630 - Headers
631
632 Authorization: Bearer JWT
633 X-Requested-With: XMLHttpRequest
634
635 - Attributes
636 - name: `Foo Event` (string, required)
637 - is_published: true (boolean, optional) - defaults to true
638 - location_id: 5 (number, required)
639 - `host_name`: `Foo Event Host Name` (string, required)
640 - start_date: `2018-01-01` (string, required)
641 - end_date: `2018-01-02` (string, required)
642 - series_ids (array, optional)
643 - 2 (number, required) - ID of Series
644 - `registration_dates` (array, required)
645 - (object)
646 - `date`: `2018-01-01` (string, required)
647 - `registration_deadline`: `2018-01-01 16:00:00` (string, required)
648 - `background_image` (string, optional) - Actually a file type. Required if background_image_id is not provided
649 - background_image_id: 2 (number, optional) - Required if background_image is not provided
650 - description: `Foo event description` (string)
651 - map_details: `Foo special map instructions` (string, nullable)
652 - gate_limit: 40 (number, nullable)
653 - contact_links (array, nullable)
654 - (object)
655 - type: `phone` (string, required) - Must be phone, email, or url
656 - value: `555-555-5555` (string, required)
657
658- Response 201 (application/json)
659 - Attributes (EventResponse)
660
661
662## Certain Event [/events/{event_id}]
663- Parameters
664 - event_id: 7 (number, required) - Id of a event
665
666### Update an Event [PATCH]
667- Request (application/json)
668 - Headers
669
670 Authorization: Bearer JWT
671 X-Requested-With: XMLHttpRequest
672
673 - Attributes
674 - name: `Foo Event` (string)
675 - is_published: true (boolean, optional) - defaults to true
676 - `host_name`: `Foo Event Host Name` (string)
677 - start_date: `2018-01-01` (string)
678 - end_date: `2018-01-02` (string)
679 - series_ids (array, optional)
680 - 2 (number, required) - ID of Series
681 - registration_dates (array)
682 - (object)
683 - date: `2018-01-01` (string)
684 - registration_deadline: `2018-01-01 16:00:00` (string)
685 - background_image (string, optional) - Actually a file type
686 - background_image_id: 2 (number, optional)
687 - media_id: 2 (number, optional) - sent if not trying to update background image returned by current model
688 - description: `Foo event description` (string)
689 - map_details: `Foo special map instructions` (string, nullable)
690 - gate_limit: 40 (number, nullable)
691 - false (boolean)
692 - memberships (array, nullable, optional)
693 - (array) - Keep each 'or' required group in one key
694 - 1 (number)
695 - 2 (number)
696 - (array) - Keep each 'or' required group in one key
697 - 2 (number)
698 - fees (array, nullable, optional)
699 - (object)
700 - id (optional) - Id if we're updating a fee
701 - event_fee_type_id: 1 (number, required) - Id of fee type
702 - name: Foo Fee (string, required)
703 - required: true (boolean, required) - Whether or not this fee is required to be paid
704 - price: `3995` (number, required)
705 - forward_fees_id: 1 (nullable, optional, number)
706 - forward_fees_custom: Custom forward (nullable, optional, string)
707 - contact_links (array, nullable, optional)
708 - (object)
709 - type: `phone` (string) - Must be phone, email, or url
710 - value: `555-555-5555` (string)
711 - event_race_classes (array, optional, nullable) - This is an array of all classes (must resend existing) the user wishes to be attached to the event.
712 - (object)
713 - race_class_id: `1` (number, required) - id
714 - event_race_class_category_id: `1` (number, required) - id
715 - `age_marker`: calendar_year (string, required)
716 - discount_exempt: false (boolean, required)
717 - price: `3995` (number, required)
718 - waiver_ids (array, optional, nullable)
719 - 1 (number)
720
721
722- Response 200 (application/json)
723 - Attributes (EventResponse)
724
725
726### Get an Event [GET]
727- Request (application/json)
728 - Headers
729
730 X-Requested-With: XMLHttpRequest
731
732- Response 200 (application/json)
733 - Attributes (EventResponse)
734
735
736##Season Pass [/events/{event_id}/season_passes]
737- Parameters
738 - event_id: 7 (number, required) - Id of an event
739
740### Add Event Season Pass [POST]
741- Request (application/json)
742 - Headers
743
744 Authorization: Bearer JWT
745 X-Requested-With: XMLHttpRequest
746
747 - Attributes
748 - `name`: `Foo pass` (string, required)
749 - price: 20 (number, required)
750 - limit: 2 (number, required)
751 - `num_available`: 4 (number, required)
752 - covers_pro_classes: false (boolean, optional)
753
754- Response 201 (application/json)
755 - Attributes (EventResponse)
756
757
758
759# Group Global Event Race Class Categories
760## Global Event Race Class Categories [/events/event_race_class_categories]
761### Get All Global Event Race Class Categories [GET]
762- Request (application/json)
763 - Headers
764
765 X-Requested-With: XMLHttpRequest
766
767- Response 200 (application/json)
768 - Attributes (array[GlobalEventRaceClassCategoryResponse])
769
770
771# Group Event Fee Types
772## Event Fee Types [/events/event_fee_types]
773### Get All Event Fee Types [GET]
774- Request (application/json)
775 - Headers
776
777 X-Requested-With: XMLHttpRequest
778
779- Response 200 (application/json)
780 - Attributes (array[FeeTypeResponse])
781
782
783
784# Group Sponsors
785## Sponsors [/sponsors]
786### Get All Sponsors [GET]
787- Request (application/json)
788 - Headers
789
790 X-Requested-With: XMLHttpRequest
791
792- Response 200 (application/json)
793 - Attributes (array[SponsorResponse])
794
795
796### Add New Sponsor [POST]
797- Request (application/json)
798 - Headers
799
800 Authorization: Bearer JWT
801 X-Requested-With: XMLHttpRequest
802
803 - Attributes
804 - name: `Dredd Sponsor` (string, required)
805
806- Response 201 (application/json)
807 - Attributes (SponsorResponse)
808
809
810# Group Stripe
811## Payment Methods [/users/{user_id}/stripepaymenttokens]
812- Parameters
813 - user_id: 6 (number, required) - Id of a user
814### Add Stripe Token [POST]
815- Request (application/json)
816 - Headers
817
818 Authorization: Bearer JWT
819 X-Requested-With: XMLHttpRequest
820
821 - Attributes
822 - token: tok_visa (string, required) - Stripe token
823 - type: card (string, required) - Will always be card
824 - brand: Visa (string, required) - Brand of card
825 - last4: 1234 (string, required) - Last 4 of card
826
827- Response 201 (application/json)
828 - Attributes (StripePaymentTokenResponse)
829
830
831### Get Payment Methods [GET]
832- Request (application/json)
833 - Headers
834
835 Authorization: Bearer JWT
836 X-Requested-With: XMLHttpRequest
837
838- Response 200 (application/json)
839 - Attributes (array[StripePaymentTokenResponse])
840
841
842## Specific Payment Method [/users/{user_id}/stripepaymenttokens/{stripe_payment_token_id}]
843- Parameters
844 - user_id: 6 (number, required) - Id of a user
845 - stripe_payment_token_id: 1 (number, required) - Id of payment method
846### Certain Payment Method [GET]
847- Request (application/json)
848 - Headers
849
850 Authorization: Bearer JWT
851 X-Requested-With: XMLHttpRequest
852
853- Response 200 (application/json)
854 - Attributes (StripePaymentTokenResponse)
855
856
857### Delete Payment Method [DELETE]
858- Request (application/json)
859 - Headers
860
861 Authorization: Bearer JWT
862 X-Requested-With: XMLHttpRequest
863
864- Response 204
865
866
867
868# Group Cart
869## Cart [/users/{user_id}/cart]
870- Parameters
871 - user_id: 6 (number, required) - Id of a user
872### Add Items to Cart [POST]
873- Request (application/json)
874 - Headers
875
876 Authorization: Bearer JWT
877 X-Requested-With: XMLHttpRequest
878
879 - Attributes
880 - items (array, required)
881 - (object)
882 - purchasable_type: App\EventFee (string, required) - Class of purchaseable
883 - purchasable_id: 3 (number, required) - Id of purchaseable item
884 - quantity: 1 (number, required)
885 - (object)
886 - purchasable_type: App\EventFee (string, required) - Class of purchaseable
887 - purchasable_id: 1 (number, required) - Id of purchaseable item
888 - quantity: 1 (number, required)
889 - (object)
890 - purchasable_type: App\Membership (string, required) - Class of purchaseable
891 - purchasable_id: 1 (number, required) - Id of purchaseable item
892 - quantity: 1 (number, required)
893 - self_reported: true (boolean, optional) - Only include if true
894 - (object)
895 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
896 - purchasable_id: 5 (number, required) - Id of purchaseable item
897 - quantity: 1 (number, required)
898 - (object)
899 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
900 - purchasable_id: 60 (number, required) - Id of purchaseable item
901 - quantity: 1 (number, required)
902
903- Response 201 (application/json)
904 - Attributes (CartResponse)
905
906
907### Get Items in Cart [GET]
908- Request (application/json)
909 - Headers
910
911 Authorization: Bearer JWT
912 X-Requested-With: XMLHttpRequest
913
914- Response 200 (application/json)
915 - Attributes (CartResponse)
916
917
918## Specific Cart [/users/{user_id}/carts/{cart_id}]
919- Parameters
920 - user_id: 6 (number, required) - Id of a user
921 - cart_id: 1 (number, required) - Id of that user's cart
922### Get a Specific Cart [GET]
923- Request (application/json)
924 - Headers
925
926 Authorization: Bearer JWT
927 X-Requested-With: XMLHttpRequest
928
929- Response 200 (application/json)
930 - Attributes (CartResponse)
931
932
933
934## Apply Promocode [/users/{user_id}/cart/applypromocode]
935- Parameters
936 - user_id: 6 (number, required) - Id of a user
937### Apply Promocode [POST]
938- Request (application/json)
939 - Headers
940
941 Authorization: Bearer JWT
942 X-Requested-With: XMLHttpRequest
943
944 - Attributes
945 - promocode_id: 1 (number, required)
946
947- Response 200 (application/json)
948 - Attributes (CartResponse)
949
950
951## Checkout [/cart/checkoutmultiple]
952### Checkout Multiple Users [POST]
953- Request (application/json)
954 - Headers
955
956 Authorization: Bearer JWT
957 X-Requested-With: XMLHttpRequest
958
959 - Attributes
960 - token_id: 1 (number, required)
961 - user_ids (array, required)
962 - 6 (number)
963
964- Response 200 (application/json)
965 - Attributes (array[CartResponse])
966
967
968## Get Cart History [/users/{user_id}/carts/completed]
969- Parameters
970 - user_id: 6 (number, required) - Id of a user
971### Get a User's Cart History [GET]
972- Request (application/json)
973 - Headers
974
975 Authorization: Bearer JWT
976 X-Requested-With: XMLHttpRequest
977
978- Response 200 (application/json)
979 - Attributes (array[CartResponse])
980
981
982## Cart2 [/users/{user_id}/cart]
983- Parameters
984 - user_id: 6 (number, required) - Id of a user
985### Add Items to Cart2 [POST]
986- Request (application/json)
987 - Headers
988
989 Authorization: Bearer JWT
990 X-Requested-With: XMLHttpRequest
991
992 - Attributes
993 - items (array, required)
994 - (object)
995 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
996 - purchasable_id: 1 (number, required) - Id of purchaseable item
997 - quantity: 1 (number, required)
998 - bike_id: 1 (number, optional) - Id of bike for specified eventraceclass
999 - (object)
1000 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
1001 - purchasable_id: 2 (number, required) - Id of purchaseable item
1002 - quantity: 1 (number, required)
1003 - (object)
1004 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
1005 - purchasable_id: 3 (number, required) - Id of purchaseable item
1006 - quantity: 1 (number, required)
1007 - (object)
1008 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
1009 - purchasable_id: 4 (number, required) - Id of purchaseable item
1010 - quantity: 1 (number, required)
1011 - (object)
1012 - purchasable_type: App\EventRaceClass (string, required) - Class of purchaseable
1013 - purchasable_id: 61 (number, required) - Id of purchaseable item
1014 - quantity: 1 (number, required)
1015
1016- Response 201 (application/json)
1017 - Attributes (CartResponse)
1018
1019
1020## Checkout2 [/cart/checkoutmultiple]
1021### Checkout Multiple Users2 [POST]
1022- Request (application/json)
1023 - Headers
1024
1025 Authorization: Bearer JWT
1026 X-Requested-With: XMLHttpRequest
1027
1028 - Attributes
1029 - token_id: 1 (number, required)
1030 - user_ids (array, required)
1031 - 6 (number)
1032
1033- Response 200 (application/json)
1034 - Attributes (array[CartResponse])
1035
1036# Group States
1037## States [/states]
1038### Get All States [GET]
1039- Request (application/json)
1040 - Headers
1041
1042 X-Requested-With: XMLHttpRequest
1043
1044- Response 200 (application/json)
1045 - Attributes (array[StateResponse])
1046
1047
1048## Certain State [/states/{state_id}]
1049- Parameters
1050 - state_id: 1 (number, required) - Id of a state
1051### Get a State [GET]
1052- Request (application/json)
1053 - Headers
1054
1055 X-Requested-With: XMLHttpRequest
1056
1057- Response 200 (application/json)
1058 - Attributes (StateResponse)
1059
1060
1061# Group Users
1062## Current User [/users/me]
1063### Get Current User [GET]
1064- Request (application/json)
1065 - Headers
1066
1067 Authorization: Bearer JWT
1068 X-Requested-With: XMLHttpRequest
1069
1070- Response 200 (application/json)
1071 - Attributes (CurrentUserResponse)
1072
1073
1074
1075# Data Structures
1076
1077## `OAuth jwt-bearer grant request` (object)
1078- `grant_type`: `urn:ietf:params:oauth:grant-type:jwt-bearer` (string, required)
1079- assertion: `eyJhbGciOiJIUzI1NiJ9.e30.XmNK3GpH3Ys_7wsYBfq4C3M6goz71I7dTgUkuIa5lyQ` (string, required)
1080
1081## OAuth valid response (object)
1082- `access_token`: `eyJhbGciOiJIUzI1NiJ9.e30.XmNK3GpH3Ys_7wsYBfq4C3M6goz71I7dTgUkuIa5lyQ` (string, required) - valid JWT
1083- `expires_at`: `2019-10-16 05:26:13` (string, required) - The date/time (ISO8601 format) associated with this choice
1084- `token_type`: Bearer (string, required)
1085
1086## Server response (object)
1087- status: ok (string, required)
1088
1089## NewRacerStore
1090- `first_name`: `Test` (string, required)
1091- `last_name`: `Racer` (string, required)
1092- `email`: `testracer@example.com` (string, required)
1093- `password`: password (string, required)
1094- `type`: `racer` (string, required)
1095- relationships (array, nullable, optional)
1096 - (object)
1097 - relation: `manager` (required, string) - String either: manager or guardian
1098 - user_id: 1 (required, number) - Id of manager or guardian
1099
1100## NewGuardianStore
1101- `first_name`: `Test` (string, required)
1102- `last_name`: `Racer` (string, required)
1103- `email`: `testguardian@example.com` (string, required)
1104- `password`: `password` (string, required)
1105- `type`: `guardian` (string, required)
1106
1107## NewManagerStore
1108- `first_name`: `Test` (string, required)
1109- `last_name`: `Racer` (string, required)
1110- `email`: `testmanager@example.com` (string, required)
1111- `password`: `password` (string, required)
1112- `type`: `manager` (string, required)
1113
1114## NewPromoterAdminStore
1115- `first_name`: `Test` (string, required)
1116- `last_name`: `Promoter Admin` (string, required)
1117- `email`: `testpromoteradmin@example.com` (string, required)
1118- `password`: `password` (string, required)
1119- `type`: `promoterAdmin` (string, required)
1120
1121## NewUserResponse
1122- `id`: 1 (number)
1123- `first_name` (string)
1124- `last_name` (string)
1125- `email` (string)
1126- `token` (string)
1127
1128## BasicUserResponse
1129- `id` (number)
1130- `first_name` (string)
1131- `last_name` (string)
1132- `sponsors` (array[SponsorResponse])
1133
1134## UserChildResponse
1135- `id` (number)
1136- `first_name` (string)
1137- `last_name` (string)
1138- `sponsors` (array[SponsorResponse])
1139- `cart_managed_by_current_user` (boolean)
1140
1141## CurrentUserResponse
1142- include BasicUserResponse
1143- `email` (string)
1144- `media_id` (number, nullable)
1145- `image_url` (string, nullable)
1146- `bikes` (array[BikeResponse])
1147- `season_passes` (array[SeasonPassResponse])
1148- `memberships` (array[UserMembershipResponse])
1149- `relationships` (object)
1150 - guardian (object)
1151 - children (array[UserChildResponse])
1152 - parents (array[UserChildResponse])
1153 - manager (object)
1154 - children (array[UserChildResponse])
1155 - parents (array[UserChildResponse])
1156
1157## UserMembershipResponse
1158- id (number)
1159- name (string)
1160- is_active (boolean)
1161
1162## SponsorResponse
1163- `id` (number)
1164- `name` (string)
1165- `logo_uri` (string, nullable)
1166- `creator_id` (number)
1167
1168## BikeStore
1169- `number` (string, required)
1170- `brand_id` (number, required)
1171- `engine_size_id` (number, required)
1172- `vin` (string, nullable)
1173
1174## BikeUpdate
1175- `number` (string, optional)
1176- `brand_id` (number, optional)
1177- `engine_size_id` (number, optional)
1178- `vin` (string, optional, nullable)
1179
1180## BikeResponse
1181- `id` (number)
1182- `number` (string)
1183- `user_id` (number)
1184- `brand` (BikeBrandResponse)
1185- `engine_size` (BikeEngineSizeResponse)
1186- `vin` (string, optional, nullable)
1187
1188## BikeBrandResponse
1189- `id` (number)
1190- `name` (string)
1191- `code` (string)
1192- `color` (string)
1193- `logo_uri` (string, nullable)
1194
1195## BikeEngineSizeResponse
1196- `id` (number)
1197- `name` (string)
1198
1199## SpatieImageResponse
1200- `id` (number)
1201- `url` (string)
1202
1203## SeriesResponse
1204- `id` (number)
1205- `name` (string)
1206- `is_published` (boolean)
1207- `host_name` (string)
1208- `start-date` (string)
1209- `end-date` (string)
1210- `event_ids` (array[number])
1211- `image_url` (string)
1212
1213## WaiverResponse
1214- `id` (number)
1215- `name` (string)
1216- `text` (string)
1217- `image_url` (string, nullable)
1218
1219## EventRaceClassResponse
1220- `id` (number)
1221- `purchasable_type` (string)
1222- `min_age` (number)
1223- `max_age` (number)
1224- `skill_level` (SkillLevelResponse)
1225- `age_marker` (string)
1226- `discount_exempt` (boolean)
1227- `price` (number)
1228- `is_split` (boolean)
1229- `uses_heats` (boolean)
1230- `num_lcq` (number)
1231
1232## SkillLevelResponse
1233- `id` (number)
1234- `code` (string)
1235- `name` (string)
1236
1237## GlobalEventRaceClassCategoryResponse
1238- `id` (number)
1239- `name` (string)
1240
1241## StateResponse
1242- id (number
1243- code (string)
1244- name (string)
1245
1246## LocationResponse
1247- `id` (number)
1248- `name` (string)
1249- `address` (string)
1250- `city` (string)
1251- `state` (StateResponse)
1252- `zip` (string)
1253- `lat` (number)
1254- `long` (number)
1255
1256## SeasonPassResponse
1257- `id` (number)
1258- `coverable_type` (string)
1259- `coverable_id` (number)
1260- `name` (string)
1261- `user` (BasicUserResponse)
1262- `price` (number)
1263- `limit` (number)
1264- `num_available` (number)
1265- `covers_pro_classes` (boolean)
1266
1267## EventResponse
1268- `id` (number)
1269- `name` (string)
1270- `published` (boolean)
1271- `location` (LocationResponse)
1272- `start_date` (string)
1273- `end_date` (string)
1274- `series` (array[SeriesResponse])
1275- `registration_dates` (array)
1276 - (object)
1277 - `date` (string)
1278 - `registration_deadline` (string)
1279- `media_id` (number)
1280- `image_url` (string)
1281- `description (string)
1282- `map_details` (string, nullable)
1283- `gate_limit` (number, nullable)
1284- `rfid_required` (boolean)
1285- `memberships` (array)
1286 - (array) - These are grouped by OR clauses
1287 - (object)
1288 - `id` (number)
1289 - `name` (string)
1290 - `days_valid` (number, nullable)
1291 - `valid_until` (string, nullable)
1292 - `price` (number)
1293 - `forward_fees_to` (number, nullable)
1294 - `forward_fees_to_custom` (string, nullable)
1295- `fees` (array)
1296 - (object)
1297 - id (number)
1298 - name (string)
1299 - has_choices (boolean)
1300 - choices (array)
1301 - (object)
1302 - id (number)
1303 - name (string)
1304 - limit (number)
1305 - sold_out (boolean)
1306 - type (array)
1307 - (object)
1308 - id (number)
1309 - name (string)
1310 - required (boolean)
1311 - price (number)
1312 - forward_fees_id (nullable, number)
1313 - forward_fees_custom (string)
1314- `event_season_passes` (array[SeasonPassResponse])
1315- `contact_links` (array)
1316 - (object)
1317 - `id` (number)
1318 - `type` (string)
1319 - `value` (string)
1320- `event_race_classes (array[EventRaceClassResponse])
1321- `waivers` (array[WaiverResponse])
1322
1323## DefaultRaceClassResponse
1324- id (number)
1325- name (string)
1326- `min_age` (number)
1327- `max_age` (number)
1328- `skill_level` (SkillLevelResponse)
1329- `default_age_marker` (string)
1330- `default_discount_exempt` (boolean)
1331- `default_price` (number)
1332
1333## MembershipResponse
1334- id (number)
1335- purchasable_type (string)
1336- name (string)
1337- days_valid (nullable, number)
1338- valid_until (nullable, string)
1339- price (number)
1340- forward_fees_to (nullable, optional, number)
1341- forward_fees_to_custom (nullable, optional, string)
1342
1343## FeeTypeResponse
1344- id (number)
1345- name (string)
1346
1347## CartResponse
1348- id (number)
1349- user_id (number)
1350- purchaser_id (number, nullable)
1351- paid_at (string, nullable)
1352- items (array)
1353 - (object)
1354 - id (number)
1355 - purchasable (array)
1356 - (object)
1357 - id (number)
1358 - purchasable_type (string)
1359 - price (number)
1360 - quantity (number)
1361 - effective_price (number, nullable)
1362 - purchased_price (number, nullable)
1363 options (object, nullable)
1364- promocodes (array[PromocodeResponse])
1365- subtotal (number)
1366- fees (number)
1367- total (number)
1368
1369## StripePaymentTokenResponse
1370- id (number)
1371- user_id (number)
1372- type (string)
1373- brand (string)
1374- last4 (string)
1375
1376## PromocodeResponse
1377- id (number)
1378- code (string)
1379- exp_at (string)
1380- type (string)
1381- amount (number)
1382- used_once_per (string)
1383- exclude_pros (boolean)
1384- is_repeated (boolean)
1385- repeated_count_start (number)
1386- repeated_count_max (number)
1387- affected_type (string)
1388- affected_id (number)