EarthRanger’s API enables direct programmatic access to tracking data, observations, and event creatios. Allowing you to build custom integrations, automation pipelines, or external dashboards.
Getting Started
Explore EarthRanger’s API through the following official tools and documentation:
-
Python Library: Dive into our Python library available on GitHub. Find it here: /
- Examples: /docs/examples
-
Full REST API Documentation: Once logged in to the EarthRanger admin portal, you can access the full REST API, documented here: https://sandbox.pamdas.
-
Interactive Documentation: Replace <
sandbox>
in the URL with your server name to interact with the API directly: https://sandbox.pamdas.org/
Quick Start Version
Authentication
EarthRanger uses OAuth2 tokens for API access.
- You can create a long-lived token through your Admin portal
- Or request one from the EarthRanger Support Team.
Visit the (Article title) to learn how to Create and Authentication Token in Admin portal
The general concept is that a source provider is a service that describes one or more sources that provide location information for a subject.
For example, a tracking device manufacturer is a source provider, a rhino tracker is a source and the rhino itself the subject.
As is typical, API headers:
Authorization: Bearer <token>
Accept: application/json
Content-Disposition: attachment; filename={}
Content-Type: application/json
Create an observation (track location or sensor reading)
To post a track point or sensor reading, use:
POST tohttps://<your_domain>.pamdas.org/api/v1.0/observations
The body of a location request looks like:
{
"location": {
"lat": 47.123,
"lon": -122.123
},
"recorded_at": "2019-02-19T13:59:15.000Z",
"manufacturer_id": "SomeUniqueIDForTheDevice",
"subject_name": "Car 4",
"subject_type": "vehicle",
"subject_subtype": "car",
"model_name": "Land Cruiser",
"source_type": "tracking_device",
"additional": {
"anykey": "anyvalue"
}
}
Note: If you pass in an observation where the system hasn’t seen that source-provider / manufacturer_id combination before it’ll create sources and subjects as necessary.
Create an event
To post a new Event to EarthRanger:
POST tohttps://<your_domain>.pamdas.org/api/v1.0/activity/events
Headers:
Authorization: Bearer xxxxxxxx
Accept: application/json
Content-Disposition: attachment; filename={}
Content-Type: application/json
Body example:
{
"event_type": "mist_rep",
"time": "2019-01-17T06:18:44.056439",
"priority": 100,
"location": {
"latitude": 47.123,
"longitude": -122.123
},
"event_details": {
"mistrep_Method": "Air Evac",
"mistrep_Injury": "Malaria",
"mistrep_Symptoms": "Fever and sweating",
"mistrep_Treatment": "Anti malarial medicine"
}
}
The event_type
and each key in event_details
must match a field defined in your configured Event Type schema (see Admin > Activity > Event Types).
Next in this series: Supported Input Devices for EarthRanger Integration