Overpex v0.2.1 Overpex.API
Provides a function to query the Overpass API
Summary
Functions
Query Overpass API
Functions
Query Overpass API
Options
The :url
option is used to define the URL to access the Overpass API. The default URL is http://overpass-api.de/api/interpreter
The :adapter
option defines the API adapter used to access the Overpass API. Currently the only adapters available are Overpex.API.Adapter.HTTPoison
and Overpex.API.Adapter.Fake
. Defaults to Overpex.API.Adapter.HTTPoison
on all envs except test
. On test
it defaults to Overpex.API.Adapter.Fake
The default values can be overriden using options
or by setting the appropiate values on your config
file:
config :overpex,
url: "http://overpass-api.de/api/interpreter",
adapter: Overpex.API.Adapter.HTTPoison
Return values
If the query is successfull, the function returns {:ok, response}
, where response
is a tuple {:format, body}
. :format
is either :xml
or :json
, and body
is a String with the raw body. If an error occurs, the function returns {:error, error}
, where error
is a String describing the error.