I am scraping from the NBA.com API for some shots data. The url that I am using is
url = "stats.nba.com/stats/shotchartdetail?CFID=33&CFPARAMS=2017-18&ContextFilter=&ContextMeasure=FGA&DateFrom=&DateTo=&GameID=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerID=101107&PlusMinus=N&PlayerPosition=&Rank=N&RookieYear=&Season=2017-18&SeasonSegment=&SeasonType=Regular%20Season&TeamID=0&VsConference=&VsDivision="
This website can be easily verified to exist by copying and pasting into your browser. However, when I enter the line
data = rjson::fromJSON(file = url)
I get the error: Error in file(con, "r") : cannot open the connection ... HTTP status was '403 Forbidden'.
I have tried adding http and https to the url but to no avail. Why is R not reading this url that clearly exists?