Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hockey Data Project
#9
if you know the player's name, you can use the following API: https://suggest.svc.nhl.com/svc/suggest/...veplayers/{player_name_goes_here}/99999

that's the REST call used on the NHL's player search page (https://www.nhl.com/player)

it returns an array of "suggestions"; so using https://suggest.svc.nhl.com/svc/suggest/...arls/99999 returns the following:
{
"suggestions": [
"8474590|Carlson|John|1|0|6' 3\"|217|Natick|MA|USA|1990-01-10|WSH|D|74|john-carlson-8474590",
"8478506|Carlsson|Gabriel|1|1|6' 5\"|192|Orebro||SWE|1997-01-02|CBJ|D|53|gabriel-carlsson-8478506",
"8479523|Carlsson|Lucas|1|1|6' 0\"|189|Gävle||SWE|1997-07-05|CHI|D|46|lucas-carlsson-8479523"
]
}

what's the "99999" at the end of the url for? that's the max count of items to return; i usually just leave it huge so as not to lose any results.

if you have the full name, it should return just the single match in the results (i.e. an array of 1). then just parse the pipe-delimited text to get the player's ID and you should be able to pop that into your player REST call and you're good to go.
Reply


Messages In This Thread
Hockey Data Project - by Joeylax54 - Mar-24-2020, 05:13 PM
RE: Hockey Data Project - by ndc85430 - Mar-24-2020, 07:17 PM
RE: Hockey Data Project - by Joeylax54 - Mar-24-2020, 08:07 PM
RE: Hockey Data Project - by ndc85430 - Mar-25-2020, 03:30 AM
RE: Hockey Data Project - by Joeylax54 - Mar-26-2020, 08:25 PM
RE: Hockey Data Project - by ndc85430 - Mar-28-2020, 05:16 PM
RE: Hockey Data Project - by snippsat - Mar-28-2020, 10:25 PM
RE: Hockey Data Project - by Joeylax54 - Mar-29-2020, 05:20 AM
RE: Hockey Data Project - by yummykudos - Apr-18-2020, 02:20 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020