jozefhajnala / nhlapi

A Minimum-Dependency R Interface to the NHL API
GNU Affero General Public License v3.0
30 stars 7 forks source link

nhl_schedule_seasons(2016, gameType = "R") results in an HTTP 500 Error #11

Closed JonasGlow closed 3 years ago

JonasGlow commented 3 years ago

Trying to get the schedule for season 2016 will result in an HTTP 500 error. Pulling for other seasons (2005-2019) worked for me.

`nhl_schedule_seasons(2016, gameType = "R")

17:37:59 | 7 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017 error for attempt no: 0 HTTP error 500. 17:38:00 | 7 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017 error for attempt no: 1 HTTP error 500. 17:38:01 | 7 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017 error for attempt no: 2 HTTP error 500. 17:38:01 | 5 | E | The following 1 of 1 url retrievals errored:$ https://statsapi.web.nhl.com/api/v1/schedule?season=20162017 `

Not sure if this a problem based on the R interface or the official API. I will test it with the low-level interface in the upcoming days and will then post an update.

If it is a mistake on my part, please let me know!

Edit: Using the low-level interface gives the same result. Therefore, I would assume that the problem comes from the official API.

` url <- "https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R" nhl_get_data(URL)

17:59:51 | 5 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R error for attempt no: 0 HTTP error 500. 17:59:52 | 5 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R error for attempt no: 1 HTTP error 500. 17:59:53 | 5 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R error for attempt no: 2 HTTP error 500. 17:59:53 | 3 | E | The following 1 of 1 url retrievals errored:$ https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R `

jozefhajnala commented 3 years ago

Hi Jonas,

Thanks for taking the time to report this!

Indeed this looks to me like an issue in the API itself. We can also test this by just opening the link in a web browser, for instance, when opening: https://statsapi.web.nhl.com/api/v1/schedule?season=20172018&gameTypes=R. This shows the resulting json no problem in a browser window.

However, if doing the same, just with 20162017 instead of 20172018, we do not get meaningful results (at least as of today): https://statsapi.web.nhl.com/api/v1/schedule?season=20162017&gameTypes=R