Open eric-labelle opened 1 month ago
Not sure if this helps, but i'm using the/v1/roster/{teamAbbrev}/current
endpoint (which will redirect to the current active season). If player doesn't show, it's likely because the NHL hasn't officially processed the player as a member of a team yet. I know when it was announced (even by the NHL) that Guentzel was traded to Tampa, he wasn't showing on their roster yet and didn't for a few days even after his contract was signed and finalized.
Yes following trades I noticed it takes sometime a few days, but these players have been on their respective teams for years 🤷♂️
At least it's consistent with the nhl's website clearly populated by these APIs
Hey Eric, not sure if this is useful for you but I'll give it a shot. Once the season starts, you should be able to use the stat leaders endpoint.
https://api-web.nhle.com/v1/skater-stats-leaders/current?categories=toi&limit=9999
If you set the limit high enough you'll get every player that has played a shift in the season. However if you want players on new teams during the offseason, or players on roster that are out long term like Nichushkin or Landeskog this probably won't be the best option.
Another option, and probably your best bet, is to use their search API that I reverse-engineered from this page. This returns all players in their database, from players that played over a century ago and even all the 2024 draft picks!
https://search.d3.nhle.com/api/v1/search/player?culture=en-us&limit=99999&q=%2A
Obviously this is a massive call, so maybe explore some of the flags to make it more efficient such as the &active=true
flag. Each player is returned as an object that contains their current team and the last season that they played. Players like Nichuskin, Reichel, and Landeskog are all listed as active players, but have their last seasons listed as 2023-24, 2023-24, and 2021-22, respectively. This explains why they aren't showing up in the teams' active rosters, because for a player to appear on team 21 (Chicago)'s active roster they must have:
active=true
teamId=21
lastSeasonId=20242025
The only setback here is that it might be tough to differentiate between rookies that are going to play like Celebrini, Michkov and Hutson against players that are owned by NHL teams but have no chance of playing.
Another option, and probably your best bet, is to use their search API that I reverse-engineered from this page. This returns all players in their database, from players that played over a century ago and even all the 2024 draft picks!
https://search.d3.nhle.com/api/v1/search/player?culture=en-us&limit=99999&q=%2A
Obviously this is a massive call, so maybe explore some of the flags to make it more efficient such as the
&active=true
flag. Each player is returned as an object that contains their current team and the last season that they played. Players like Nichuskin, Reichel, and Landeskog are all listed as active players, but have their last seasons listed as 2023-24, 2023-24, and 2021-22, respectively. This explains why they aren't showing up in the teams' active rosters, because for a player to appear on team 21 (Chicago)'s active roster they must have:
active=true
teamId=21
lastSeasonId=20242025
The only setback here is that it might be tough to differentiate between rookies that are going to play like Celebrini, Michkov and Hutson against players that are owned by NHL teams but have no chance of playing.
Very interesting @andrewderango, thank you for that endpoint. The search doesn't seem to handle the teamId queryParam unfortunately but, I'll manage otherwise I guess.
// Should only return Chicago Blackhawks players but isn't.
curl -X GET "https://search.d3.nhle.com/api/v1/search/player?culture=en-us&teamId=16&limit=99999&q=%2A&active=true"
Hi, I know you don't own this API and only (did a great job) documenting it but I've been wondering if there was any API I haven't found to fetch all players?
I currently have to fetch all teams
v1/roster/{team}/20242025
, and then fetch each team's rosterv1/player/{playerId}/landing
with all the playerId found from the first call. The problem is that the roster api is often incomplete and some players are missing from teams and I can't find any way to get these missing players.Any idea/suggestion?
Here's a few examples
https://api-web.nhle.com/v1/roster/CHI/20242025
--> missingLukas Reichel
https://api-web.nhle.com/v1/roster/COL/20242025
--> missingValeri Nichushkin
andGabriel Landeskog
Thanks