Getting The Distance Between Places
Below we get the distance in miles between Los Angeles (Wikidata ID: Q65) and New York (Wikidata ID: Q60).
GraphQL
curl --request POST \ --url https://geodb-cities-graphql.p.rapidapi.com/ \ --header 'content-type: application/json' \ --header 'x-rapidapi-host: geodb-cities-graphql.p.rapidapi.com' \ --header 'x-rapidapi-key: YOUR_API_KEY' \ --data '{"query":"QUERY"}'
Where QUERY:
{ populatedPlace(id:"Q65") { distance(toPlaceId:"Q60", distanceUnit:MI) } }
REST
curl --get --include 'https://wft-geo-db.p.rapidapi.com/v1/geo/places/Q65/distance?toCityId=Q60&distanceUnit=MI' \ -H 'x-rapidapi-key: YOUR_API_KEY' \ -H 'x-rapidapi-host: wft-geo-db.p.rapidapi.com'