Search code examples
javageolocationfoursquare

foursquare multi request receives 400 bad request


I am invoking a multi request to the foursquare api that looks like so:

 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

The oAuth token is the general usage token open to public

I am creating the url with the following java code:

 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";

I am getting a 400 bad request. However this looks similar to the example in the documentation here:

 https://developer.foursquare.com/docs/multi/multi

Is there a problem with how the url is constructed?


Solution

  • If you open up that URL in your browser, you can see that the error message back from Foursquare is errorDetail: "Must provide parameter requests". You didn't construct the call correctly: https://developer.foursquare.com/docs/multi/multi