我有一个应用程序的以下详细信息:
http://45.56.112.95/location/
Device-Id: fd2364ca08f871
client-info: XXXXX
client-version: 13605
Client-Key: XYZ
Device-Info: 5.0 (asus ASUS_Z00AD)
client: mobile_android
X-Api-Version: 2.0
Latitude: 28.6254984
Longitude: 77.3783081
我尝试了两种方法来使用R中的httr包来访问应用程序,但都没有成功。以下是查询和收到的错误:
**First Try**
a <- GET("http://45.56.112.95/location/", add_headers(.headers = c(Client-Key="XYZ", Latitude = "28.6254984", Longitude = "77.3783081" )))
Error: unexpected '=' in "a <- GET("http://45.56.112.95/location/", add_headers(.headers = c(Client-Key="
**Second Try**
a = GET("http://45.56.112.95/location/", authenticate("Client-Key", "XYZ"), add_headers(.headers = c(Latitude = "28.6254984", Longitude = "77.3783081")))
Client error: (403) Forbidden
我不确定我的查询是否正确,这实际上是授权问题。或者如果我的查询错误。提前谢谢。
答案 0 :(得分:0)
尝试在Client-Key周围加上引号?
a <- GET("http://45.56.112.95/location/", add_headers(.headers = c("Client-Key"="XYZ", Latitude = "28.6254984", Longitude = "77.3783081" )))