stattleship / stattleship-r

Stattleship R Wrapper
https://api.stattleship.com/
MIT License
48 stars 14 forks source link

API Endpoint Needs Updating in R Wrapper #34

Closed torch77 closed 7 years ago

torch77 commented 7 years ago

Great work so far, I've only played around with the API via the R Wrapper for a couple of days so far but it's awesome. However, I did notice that yesterday the following code stopped working

q_body <- list(interval_type = "week", status="ended")
test <- ss_get_result(token, sport = "football",
                      league = "nfl", ep = "game_logs", query = q_body, 
                      verbose = T)

It was returning the following error

[1] "Making initial API request"
Error: lexical error: invalid char in json text.
                                       <!DOCTYPE html> <html>   <head>
                     (right here) ------^

After poking around in the source code a bit, it looks like the URL you're concatenating in line 155 (below) of the ss_get_result.R function needs to be updated to the new API endpoint.

  ## build the URL and the endpoint
  URL <- sprintf("https://www.stattleship.com/%s/%s/%s", sport, league, ep)

I forked the repo and updated it myself to api.stattleship.com and it looks like its working fine again.

Btibert3 commented 7 years ago

Can you add a Pull request so we can review the code. Seems straight forward enough, but just want to take a quick look. Thanks!

torch77 commented 7 years ago

No problem, just submitted it.

torch77 commented 7 years ago

Looks like the master has the correct URL now, thanks for updating it guys.