我正在调用foursquare api的多个请求,如下所示:
https://api.foursquare.com/v2/multi?%2Fvenues%2Fsearch%3Fll%3D33.859868%2C-117.886133%26query%3DTarget,%2Fvenues%2Fsearch%3Fll%3D33.859868%2C-117.886133%26query%3DNordstrom&intent=browse&radius=16093&oauth_token=WS10PQFRUXACDDIJMN3JEEIHFOPA1UTMRZP0E41MWAF0HHJL&v=20130419
oAuth令牌是对公众开放的一般用法令牌
我正在使用以下java代码创建url:
String baseUrl = "https://api.foursquare.com/v2";
String action = "/multi?";
String request1 = "/venues/search?ll=33.859868,-117.886133&query=Target";
String requestEnc1 = URLEncoder.encode(request1);
String request2 = "/venues/search?ll=33.859868,-117.886133&query=Nordstrom";
String requestEnc2 = URLEncoder.encode(request2);
String commonParams = "&intent=browse&radius=16093&oauth_token=WS10PQFRUXACDDIJMN3JEEIHFOPA1UTMRZP0E41MWAF0HHJL&v=20130419";
我收到400个错误请求。但是,这看起来类似于此处文档中的示例:
https://developer.foursquare.com/docs/multi/multi
网址的构建方式是否存在问题?
答案 0 :(得分:1)
如果您在浏览器中打开该URL,则可以看到Foursquare返回的错误消息为errorDetail: "Must provide parameter requests"
。您没有正确构建呼叫:https://developer.foursquare.com/docs/multi/multi