This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Venues in Foursquare
The getVenues
operation retrieves a list of recommended venues near the current location.
getVenues
<foursquare.getVenues> <ll>{$ctx:ll}</ll> <near>{$ctx:near}</near> <llAcc>{$ctx:llAcc}</llAcc> <alt>{$ctx:alt}</alt> <altAcc>{$ctx:altAcc}</altAcc> <radius>{$ctx:radius}</radius> <section>{$ctx:section}</section> <query>{$ctx:query}</query> <limit>{$ctx:limit}</limit> <novelty>{$ctx:novelty}</novelty> </foursquare.getVenues>
properties
ll
: required unless near is provided.Latitude and longitude of the user's location.near
: required unless ll is provided. A string naming a place in the world.llAcc
: Accuracy of latitude and longitude, in meters.alt
: Altitude of the user's location, in meters.altAcc
: Accuracy of the user's altitude, in meters.radius
: Radius to search within, in meters.section
: Category for filter the venues.query
: A term to be searched against a venue's tips, category, etc.limit
: Number of results to return, up to 50.novelty
: Pass new or old to limit results to places the acting user hasn't been or has been, respectively.
Sample request
Following is a sample REST/JSON request that can be handled by the getVenues
operation.
sample request for getVenues
{ "apiUrl":"%https://api.foursquare.com", "ll":"10.23,114.54", "llAcc":"1", "alt":"0", "altAcc":"1", "radius":"250", "section":"food", "query":"donuts", "limit":"20", "novelty":"new", "accessToken":"VCNCLT0LGPHREG5CFWGWKBCY0T5HOSWYALVOFOQC24IPMM4U" }
Related Foursquare documentation
https://developer.foursquare.com/docs/venues/explore
Sample Configuration
Following is a sample proxy service that illustrates how to connect to Foursquare with the init
 operation and use the getVenues
operation. The sample request for this proxy can be found in getVenues sample request. You can use this sample as a template for using other operations in this category.
Sample proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="addTips" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="ll" expression="json-eval($.ll)"/> <property name="near" expression="json-eval($.near)"/> <property name="llAcc" expression="json-eval($.llAcc)"/> <property name="alt" expression="json-eval($.alt)"/> <property name="altAcc" expression="json-eval($.altAcc)"/> <property name="limit" expression="json-eval($.limit)"/> <property name="radius" expression="json-eval($.radius)"/> <property name="query" expression="json-eval($.query)"/> <property name="section" expression="json-eval($.section)"/> <property name="novelty" expression="json-eval($.novelty)"/> <foursquare.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> </foursquare.init> <foursquare.getVenues> <ll>{$ctx:ll}</ll> <near>{$ctx:near}</near> <llAcc>{$ctx:llAcc}</llAcc> <alt>{$ctx:alt}</alt> <altAcc>{$ctx:altAcc}</altAcc> <radius>{$ctx:radius}</radius> <section>{$ctx:section}</section> <query>{$ctx:query}</query> <limit>{$ctx:limit}</limit> <novelty>{$ctx:novelty}</novelty> </foursquare.getVenues> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>