-
Notifications
You must be signed in to change notification settings - Fork 6
PokeAlarm API
DEPRECIATED - feature is still in codebase but not supported at the moment. Contact the dev team if you would like to contribute
This guide assumes:
- You have a working PokeAlarm installation.
- You are familar with REST APIs
PokeAlarm exposes a REST API that grants programmatic access to:
- Collect current location, in [lat,lon] format
- Update location
- Get an image URL of the current geofence area
Base URL |
---|
http://127.0.0.1:4000 |
The base URL will change if you override the default HOST and PORT in config.ini
or by passing -H HOST
and/or -P PORT
in the command line.
Returns the current location, set by the -l
parameter in PokeAlarm.
Request | Path |
---|---|
GET |
/location/ |
200 status code with text of current location coordinates in lat,lon format.
Current location is [40.764694, -73.973083]
Changes location of PokeAlarm.
Pass NEW_LOCATION
directly into the request URL with an empty body.
Request | Path |
---|---|
POST |
/location/?location=NEW_LOCATION |
200 status code with updated location coordinates in lat,lon format.
Location changed to : [40.764694, -73.973083]
2016-09-22 16:22:34,927 [ runwebhook] [ INFO] POST request received from 127.0.0.1.
2016-09-22 16:22:35,098 [ utils] [ INFO] Location found: 40.764694, -73.973083
2016-09-22 16:22:35,098 [ runwebhook] [ INFO] Location updated via POST request!
Retrieves a URL from Google Maps that represents the geofence area.
Request | Path |
---|---|
GET |
/geofence/ |
200 status code with response of google maps image, similar to below.
<img src="https://maps.googleapis.com/maps/api/staticmap?size=600x600&maptype=roadmap&markers=fillcolor%3Ablue%7C...>
A browser request will display an image of the geofenced area, for example:
If geofence is not enabled, the response will be your current location, with the google image pin and no bounded shaded geofence area.
If no location or geofence is enabled, the response will be no location or geofence set
.