Search code examples
pythonapifoursquare

I can't get the categories and Hierarchies in FourSquare API


In FourSquare site they say that the way to get all categories (https://developer.foursquare.com/docs/api-reference/venues/categories/) is with:

url = 'https://api.foursquare.com/v2/venues/categories&client_id={}&client_secret={}'.format(
                CLIENT_ID, 
                CLIENT_SECRET)

But I get the following error:

{
   "meta":{
      "code":400,
      "errorType":"invalid_auth",
      "errorDetail":"Missing access credentials. See https://developer.foursquare.com/docs/api/configuration/authentication for details.",
      "requestId":"5f0cee7ae116f90c6c725bcf"
   },
   "response":{

   }
}

Even tough I can make other requests and no problem is raised at all with missing access credentials. I have no idea what the problem is and I really need this json file with categories and hierarchies.


Solution

  • Your URL is wrong. Replace '&' with '?'.

    https://api.foursquare.com/v2/venues/categories&client_id={}&client_secret={} -> https://api.foursquare.com/v2/venues/categories?client_id={}&client_secret={}