-
Notifications
You must be signed in to change notification settings - Fork 2
/
nhl-openapi-3.0.yaml
3099 lines (3099 loc) · 88.5 KB
/
nhl-openapi-3.0.yaml
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
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: "3.0.0"
info:
title: NHL API
version: "1.0.0"
description: Documenting the publicly accessible portions of the NHL API.
contact:
name: NHL API documentation
url: https://github.com/erunion/sport-api-specifications
tags:
- name: conferences
- name: divisions
- name: draft
- name: games
- name: players
- name: schedule
- name: standings
- name: stats
- name: teams
servers:
- url: https://statsapi.web.nhl.com/api/v1
paths:
/conferences:
get:
summary: Get all current NHL conferences.
description: This only retrieves active conferences. For inactive conferences, use `/conferences/{id}`.
operationId: getConferences
tags:
- conferences
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Conferences"
404:
$ref: "#/components/responses/Error"
/conferences/{id}:
get:
summary: Get an NHL conference.
description: You can use this to also retrieve inactive conferences. For example, the ID for the World Cup of Hockey is `7`.
operationId: getConference
tags:
- conferences
parameters:
- name: id
in: path
required: true
description: The ID of the conference.
schema:
type: number
example: 5
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Division"
404:
$ref: "#/components/responses/Error"
/divisions:
get:
summary: Get all current NHL divisions.
description: This only retrieves active divisions. For inactive divisions, use `/divisions/{id}`.
operationId: getDivisions
tags:
- divisions
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Divisions"
404:
$ref: "#/components/responses/Error"
/divisions/{id}:
get:
summary: Get an NHL division.
description: You can use this to also retrieve inactive divisions. For example, the ID for the old Patrick division is `13`.
operationId: getDivision
tags:
- divisions
parameters:
- name: id
in: path
required: true
description: The ID of the division.
schema:
type: number
example: 15
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Division"
404:
$ref: "#/components/responses/Error"
/draft:
get:
summary: Get round-by-round data for current year's NHL Entry Draft.
operationId: getDraft
tags:
- draft
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Draft"
404:
$ref: "#/components/responses/Error"
/draft/{year}:
get:
summary: Get round-by-round data for a specific year's NHL Entry Draft.
operationId: getDraftByYear
tags:
- draft
parameters:
- name: year
in: path
required: true
description: The draft year.
schema:
type: number
pattern: ^\d{4}$
example: 2018
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Draft"
404:
$ref: "#/components/responses/Error"
/draft/prospects:
get:
summary: Get all NHL Entry Draft prospects.
description: Be forewarned that this endpoint returns a **lot** of data and there does not appear to be a way to paginate results.
operationId: getDraftProspects
tags:
- draft
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DraftProspects"
404:
$ref: "#/components/responses/Error"
/draft/prospects/{id}:
get:
summary: Get an NHL Entry Draft prospect.
operationId: getDraftProspect
tags:
- draft
parameters:
- name: id
in: path
required: true
description: The prospect ID.
schema:
type: number
example: 65242
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DraftProspects"
404:
$ref: "#/components/responses/Error"
/game/{id}/boxscore:
get:
summary: Get the boxscore for an NHL game.
description: If you want detailed play information, you should use `/game/{id}/feed/live` or `/game/{id}/feed/live/diffPatch`.
operationId: getGameBoxscore
tags:
- games
parameters:
- $ref: '#/components/parameters/gameId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GameBoxscores"
404:
$ref: "#/components/responses/Error"
/game/{id}/content:
get:
summary: Get editorials, video replays and photo highlights for an NHL game.
operationId: getGameContent
tags:
- games
parameters:
- $ref: '#/components/parameters/gameId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GameContent"
404:
$ref: "#/components/responses/Error"
/game/{id}/feed/live:
get:
summary: Get all available data for an NHL game.
description: This contains all data related to a game, from the boxscore, to play data and even on-ice coordinates. Be forewarned that, depending on the game, this endpoint can return a **lot** of data.
operationId: getGame
tags:
- games
parameters:
- $ref: '#/components/parameters/gameId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Game"
404:
$ref: "#/components/responses/Error"
/game/{id}/feed/live/diffPatch:
get:
summary: Get all available data for an NHL game after a specific time.
description: You can use this to return a small subset of data relating to game.
operationId: getGameDiff
tags:
- games
parameters:
- $ref: '#/components/parameters/gameId'
- name: startTimecode
in: query
required: true
description: The prospect ID.
schema:
type: string
pattern: ^(\d{8})_(\d{4})$
example: "20180210_0900"
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Game"
404:
$ref: "#/components/responses/Error"
/people/{id}:
get:
summary: Get an NHL player.
operationId: getPlayer
tags:
- players
parameters:
- $ref: "#/components/parameters/playerId"
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Players"
404:
$ref: "#/components/responses/Error"
/people/{id}/stats:
get:
summary: Get specific statistics for an NHL player.
operationId: getPlayerStats
tags:
- players
parameters:
- $ref: "#/components/parameters/playerId"
- name: stats
in: query
required: true
schema:
$ref: "#/components/schemas/EnumStatTypes"
description: >
Stats explanations:
* `homeAndAway` - Provides a split between home and away games.
* `byMonth` - Monthly split of stats.
* `byDayOfWeek` - Split done by day of the week.
* `goalsByGameSituation` - Shows number on when goals for a player happened like how many in the shootout, how many in each period, etc.
* `onPaceRegularSeason` - This only works with the current in-progress season and shows projected totals based on current onPaceRegularSeason.
* `regularSeasonStatRankings` - Returns where someone stands vs the rest of the league for a specific regularSeasonStatRankings
* `statsSingleSeason` - Obtains single season statistics for a player.
* `vsConference` - Conference stats split.
* `vsDivision` - Division stats split.
* `vsTeam` - Conference stats split.
* `winLoss` - Very similar to the previous modifier except it provides the W/L/OT split instead of Home and Away.
* `byDayOfWeekPlayoffs`
* `byMonthPlayoffs`
* `careerPlayoffs`
* `careerRegularSeason`
* `gameLog`
* `goalsByGameSituationPlayoffs`
* `homeAndAwayPlayoffs`
* `playoffGameLog`
* `playoffStatRankings`
* `statsSingleSeasonPlayoffs`
* `vsConferencePlayoffs`
* `vsDivisionPlayoffs`
* `vsTeamPlayoffs`
* `winLossPlayoffs`
* `yearByYear`
* `yearByYearPlayoffs`
* `yearByYearPlayoffsRank`
* `yearByYearRank`
- $ref: '#/components/parameters/season'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/PlayerStats"
404:
$ref: "#/components/responses/Error"
/schedule:
get:
summary: Get the NHL game schedule.
operationId: getSchedule
tags:
- schedule
parameters:
- $ref: "#/components/parameters/scheduleExpand"
- name: teamId
in: query
required: false
schema:
type: string
example: 28
description: Limit results to a specific team. Team ids can be found through the teams endpoint
- name: startDate
in: query
required: false
schema:
type: string
format: date
example: "2018-02-11"
description: Start date for the search.
- name: endDate
in: query
required: false
schema:
type: string
format: date
example: "2018-02-18"
description: End date for the search.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Schedule"
404:
$ref: "#/components/responses/Error"
/standings:
get:
summary: Get NHL division standings.
operationId: getStandings
tags:
- standings
parameters:
- name: season
in: query
required: false
schema:
type: string
format: date
example: "20032004"
description: "Standings for a specified season."
- name: date
in: query
required: false
schema:
type: string
format: date
example: "2018-01-09"
description: "Standings on a specified date."
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Standings"
404:
$ref: "#/components/responses/Error"
/standings/{type}:
get:
summary: Get NHL standings for a specific standing type.
operationId: getStandingsByType
tags:
- standings
parameters:
- name: type
in: path
required: true
schema:
$ref: "#/components/schemas/EnumStandingTypes"
description: >
Standing types:
* `byConference` - Standings by Conference
* `byDivision` - Standings by Division
* `byLeague` - Standings by League
* `divisionLeaders` - Division Leader standings
* `postseason` - Postseason Standings
* `preseason` - Preseason Standings
* `regularSeason` - Regular Season Standings
* `wildCard` - Wild card standings
* `wildCardWithLeaders` - Wild card standings with Division Leaders
- name: date
in: query
required: false
schema:
type: string
format: date
example: "2018-01-09"
description: "Standings on a specified date."
- name: season
in: query
required: false
schema:
type: string
format: date
example: "20032004"
description: "Standings for a specified season."
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Standings"
404:
$ref: "#/components/responses/Error"
/standingsTypes:
get:
summary: Get all available NHL standing types.
operationId: getStandingTypes
tags:
- standings
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/StandingTypes"
404:
$ref: "#/components/responses/Error"
/statTypes:
get:
summary: Get all available NHL statistic types.
operationId: getStatTypes
tags:
- stats
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/StatTypes"
404:
$ref: "#/components/responses/Error"
/teams:
get:
summary: Get all NHL teams.
operationId: getTeams
tags:
- teams
parameters:
- $ref: '#/components/parameters/teamExpand'
- $ref: '#/components/parameters/season'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Teams"
404:
$ref: "#/components/responses/Error"
/teams/{id}:
get:
summary: Get an NHL team.
operationId: getTeam
tags:
- teams
parameters:
- name: id
in: path
required: true
description: The ID of the team.
schema:
type: number
example: 28
- $ref: '#/components/parameters/teamExpand'
- $ref: '#/components/parameters/season'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Team"
404:
$ref: "#/components/responses/Error"
/teams/{id}/roster:
get:
summary: Get an NHL team's roster.
operationId: getTeamRoster
tags:
- teams
parameters:
- name: id
in: path
required: true
description: The ID of the team.
schema:
type: number
example: 28
- $ref: '#/components/parameters/season'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Rosters"
404:
$ref: "#/components/responses/Error"
/teams/{id}/stats:
get:
summary: Get all statistics for an NHL team.
operationId: getTeamStats
tags:
- teams
parameters:
- name: id
in: path
required: true
description: The ID of the team.
schema:
type: number
example: 28
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/TeamStats"
404:
$ref: "#/components/responses/Error"
components:
parameters:
gameId:
name: id
in: path
required: true
description: The ID of the game. The first 4 digits identify the season of the game (ie. 2017 for the 2017-2018 season). The next 2 digits give the type of game, where 01 = preseason, 02 = regular season, 03 = playoffs, 04 = all-star. The final 4 digits identify the specific game number. For regular season and preseason games, this ranges from 0001 to the number of games played. (1271 for seasons with 31 teams (2017 and onwards) and 1230 for seasons with 30 teams). For playoff games, the 2nd digit of the specific number gives the round of the playoffs, the 3rd digit specifies the matchup, and the 4th digit specifies the game (out of 7).
schema:
type: number
example: 2017020851
playerId:
name: id
in: path
required: true
description: The ID of the player.
schema:
type: number
example: 8466138
season:
name: season
in: query
description: Return a team's specific season.
required: false
schema:
type: string
example: "20172018"
teamExpand:
name: expand
in: query
description: >
Expand explanations:
* `team.roster` - Shows roster of active players for the specified team.
* `person.names` - Same as above, but gives less info.
* `team.schedule.next` - Returns details of the upcoming game for a team.
* `team.schedule.previous` - Same as above but for the last game played.
* `team.stats` - Returns the teams stats for the season.
required: false
schema:
$ref: "#/components/schemas/EnumExpandTeams"
scheduleExpand:
name: expand
in: query
description: >
Expand explanations:
* `schedule.brodcasts` - Shows the broadcasts of the game.
* `schedule.linescore` - Linescore for completed games.
* `schedule.ticket` - Provides the different places to buy tickets for the upcoming games.
required: false
schema:
$ref: "#/components/schemas/EnumExpandSchedule"
responses:
Error:
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
schemas:
Conference:
properties:
id:
type: number
example: 5
name:
type: string
enum:
- "Eastern"
- "Western"
- "World Cup of Hockey"
link:
type: string
format: uri
example: "/api/v1/conferences/5"
abbreviation:
type: string
enum:
- "E"
- "W"
- "WCH"
shortName:
type: string
enum:
- "East"
- "West"
- "WCup"
active:
type: boolean
Conferences:
properties:
copyright:
type: string
teams:
type: array
items:
type: object
$ref: "#/components/schemas/Conference"
Division:
properties:
id:
type: number
example: 15
name:
type: string
example: "Pacific"
link:
type: string
format: uri
example: "/api/v1/divisions/15"
abbreviation:
type: string
example: "P"
conference:
type: object
properties:
id:
type: number
example: 5
name:
type: string
example: "Western"
link:
type: string
format: uri
example: "/api/v1/conferences/5"
active:
type: boolean
Divisions:
properties:
copyright:
type: string
divisions:
type: array
items:
type: object
$ref: "#/components/schemas/Division"
Draft:
properties:
copyright:
type: string
drafts:
type: array
items:
type: object
properties:
draftYear:
type: number
example: 2017
rounds:
type: array
items:
type: object
properties:
roundNumber:
type: number
example: 1
round:
type: string
example: "1"
picks:
type: array
items:
type: object
properties:
year:
type: number
example: 2017
round:
type: string
example: "1"
pickOverall:
type: number
example: 1
pickInRound:
type: number
example: 1
team:
type: object
properties:
id:
type: number
example: 1
name:
type: string
example: "New Jersey Devils"
link:
type: string
format: uri
example: "/api/v1/teams/1"
prospect:
type: object
properties:
id:
type: number
example: 65242
fullName:
type: string
example: "Nico Hischier"
link:
type: string
format: uri
example: "/api/v1/draft/prospects/65242"
DraftProspect:
properties:
id:
type: number
example: 65242
fullName:
type: string
example: "Nico Hischier"
link:
type: string
format: uri
example: "/api/v1/draft/prospects/65242"
firstName:
type: string
example: "Nico"
lastName:
type: string
example: "Hischier"
birthDate:
type: string
format: date
example: "1999-01-04"
birthCity:
type: string
example: "Naters"
birthCountry:
type: string
example: "CHE"
nationality:
type: string
example: "CHE"
height:
type: string
example: "6' 2\""
weight:
type: number
example: 179
shootsCatches:
type: string
example: "L"
primaryPosition:
type: object
properties:
code:
type: string
example: "C"
name:
type: string
example: "Center"
type:
type: string
example: "Forward"
abbreviation:
type: string
example: "C"
prospectCategory:
type: object
properties:
id:
type: number
example: 1
shortName:
type: string
example: "NA Skater"
name:
type: string
example: "North American Skater"
amateurTeam:
type: object
properties:
link:
type: string
format: uri
example: "/api/v1/teams/null"
amateurLeague:
type: object
properties:
link:
type: string
format: uri
example: "/api/v1/league/null"
ranks:
type: object
DraftProspects:
properties:
copyright:
type: string
prospects:
type: array
items:
type: object
$ref: "#/components/schemas/DraftProspect"
Error:
properties:
messageNumber:
type: number
example: 10
message:
type: string
example: "Object not found"
Franchise:
properties:
id:
type: number
example: 29
name:
type: string
example: "Sharks"
link:
type: string
format: uri
example: "/api/v1/franchises/29"
Game:
properties:
copyright:
type: string
gamePk:
type: number
example: 2017020851
link:
type: string
format: uri
example: "/api/v1/game/2017020851/feed/live"
metaData:
type: object
properties:
wait:
type: number
example: 10
timeStamp:
type: string
example: "20180211_054345"
gameData:
type: object
properties:
game:
type: object
properties:
pk:
type: number
example: 2017020851
season:
type: string
example: "20172018"
type:
type: string
example: "R"
datetime:
type: object
properties:
dateTime:
type: string
format: date-time
example: "2018-02-11T03:00:00Z"
endDateTime:
type: string
format: date-time
example: "2018-02-11T05:30:42Z"
status:
type: object
properties:
abstractGameState:
type: string
example: "Final"
codedGameState:
type: string
example: "7"
detailedState:
type: string
example: "Final"
statusCode:
type: string
example: "7"
startTimeTBD:
type: boolean
teams:
type: object
properties:
away:
type: object
$ref: "#/components/schemas/Team"
home:
type: object
$ref: "#/components/schemas/Team"
players: # this is actually an associative array with keys like `ID8471709`
type: object
$ref: "#/components/schemas/Player"
venue:
type: object
properties:
name:
type: string
example: "SAP Center at San Jose"
link:
type: string
format: uri
example: "/api/v1/venues/null"
liveData:
type: object
properties:
plays:
type: object
properties:
allPlays:
type: array
items:
type: object
$ref: "#/components/schemas/GamePlay"
scoringPlays:
type: array
items:
type: number
penaltyPlays:
type: array
items:
type: number
playsByPeriod:
type: array
items:
type: object
properties:
startIndex:
type: number
example: 0
plays:
type: array
items:
type: number
endIndex:
type: number