Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats beyond the skater summary? #16

Open
jmai444 opened this issue Feb 19, 2018 · 5 comments
Open

Stats beyond the skater summary? #16

jmai444 opened this issue Feb 19, 2018 · 5 comments

Comments

@jmai444
Copy link

jmai444 commented Feb 19, 2018

Do you have an idea how to query to include stats like face off wins and takeaways by player? I can only find them in the game/boxscore endpoint. Thanks! This documentation is fantastic!

@dword4
Copy link
Owner

dword4 commented Feb 19, 2018

Unfortunately I've yet to find where this information is accessed in this API, however there is a second one that drives the advanced stats and reports available from the NHL website. I haven't managed to really get much from it yet however, but a good start would be to check out http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=basic&isGame=false&reportName=skatersummary&sort=%5B%7B%22property%22:%22points%22,%22direction%22:%22DESC%22%7D%5D&cayenneExp=gameTypeId=2%20and%20seasonId=20162017 and then see if you can figure out how to make it show the correct report type which I haven't had any luck on yet

@jmai444
Copy link
Author

jmai444 commented Feb 19, 2018

Thanks for the tip. With a little intuition I was able to make your suggestion work! Just switched out the reportName parameter of the rest api for what is shown as the report parameter in the URL of the NHL stats web page for the report selection you want. You'll need to update the sort parameters or remove them altogether. Examples below.

Face off report:
http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=basic&isGame=false&reportName=faceoffs&cayenneExp=gameTypeId=2%20and%20seasonId=20162017

Hits, blocks, takeaways, etc.
http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=basic&isGame=false&reportName=realtime&sort=[{%22property%22:%22hits%22,%22direction%22:%22DESC%22}]&cayenneExp=gameTypeId=2%20and%20seasonId=20162017

SAT percentages:
http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=basic&isGame=false&reportName=skaterpercentages&cayenneExp=gameTypeId=2%20and%20seasonId=20162017
EDIT: just noticed this one doesn't work - returns only basic player data.

I suspect all different reports on the web site are available through the rest api using this method.

Thanks again!

@jmai444
Copy link
Author

jmai444 commented Feb 19, 2018

Here we go.
SAT percentages:
http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=shooting&isGame=false&reportName=skaterpercentages&cayenneExp=gameTypeId=2%20and%20seasonId=20172018

Needed to change the reportType parameter as well as the reportName. Hat tip to one of the responders in your reddit thread about a month ago.

@dword4
Copy link
Owner

dword4 commented Feb 19, 2018

Awesome, think I'm going to have to start another document to cover this advanced stats API section, its a lot more flexible than the other API which seems more for game data than anything else.

@jmai444
Copy link
Author

jmai444 commented Mar 5, 2018

I also found this repo which may help with understanding how to query the NHL REST API:
https://github.com/nhl/link-rest

It doesn't document the NHL specific endpoints and parameters, but there is documentation on the framework used in the API. I haven't had a chance to look closely.

Currently trying to figure out how to aggregate a game by game report and sum the last x number of days for a report as you can from the web site. Not much success so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants