Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 403来自单个URI请求的错误响应?_Ruby_Espn - Fatal编程技术网

Ruby 403来自单个URI请求的错误响应?

Ruby 403来自单个URI请求的错误响应?,ruby,espn,Ruby,Espn,当尝试使用live API explorer并使用我的API密钥时,我可以得到良好的响应。然而,当在我的应用程序中使用从资源管理器生成的相同URI链接时,我得到一个403错误。但是,应用程序只发出一个请求 url = URI.parse("http://api.espn.com/v1/sports/basketball/nba/athletes/355? apikey=xxxxxxxxxxxxxxxx") req = Net::HTTP::Get.new(url.path) res = Ne

当尝试使用live API explorer并使用我的API密钥时,我可以得到良好的响应。然而,当在我的应用程序中使用从资源管理器生成的相同URI链接时,我得到一个403错误。但是,应用程序只发出一个请求

url = URI.parse("http://api.espn.com/v1/sports/basketball/nba/athletes/355?
apikey=xxxxxxxxxxxxxxxx")  
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
  http.request(req)
}
puts res.body
以下是终端中的响应:

{
  "status": "error",
  "code": 403,
  "message" : "Account Inactive"
}
403应该意味着我超出了我的限制,但消息说帐户处于非活动状态。这是一个新帐户,我得到确认,它是活跃的。另外,我的API密钥在web界面中工作


有什么想法吗?

看起来您只是在使用URI字符串中的路径,而没有在GET调用中传递查询参数。