简体   繁体   中英

Four Square API use of section in query in R

Defining x , y , and z as "10013","XXXX","20170104" and using

w <- paste("https://api.foursquare.com/v2/venues/search?near=",x,"&section='food'&oauth_token=",y,"&v=",z,sep="")
u <- getURL(w)
test <- RJSONIO::fromJSON(u)

does not return a good result, but if I replace section='food' with query='food' it will search for food in the name of the location (I replaced the authorization token with XXXX here).

The venues/search endpoint you're using doesn't have a section parameter. The section parameter is valid with the venues/explore endpoint if that's what you mean to be trying -> https://api.foursquare.com/v2/venues/explore

Note that /search and /explore are designed to accomplish very different things and you should read the docs before you just switch over.

/explore should be used to return recommended venues near a location. (example: coffee shop)

/search should be used to return a specific venue or venues near a location. (example: Starbucks)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM