Note: This repository is from circa 2020/21, and may be out of date. Please refer to https://docs.lightbug.io for the most up-to-date information.
API for retrieving tracking data and changing settings on LightBug & RemoteThings tracking devices
- API version: 1.1.0
PHP 5.6 and later
clone locally and run composer install
Download the files and include autoload.php:
require_once('/path/to/tracking-api-php/vendor/autoload.php');See examples/getting-started.php
To register for HTTP push, see register_push.php and push_receiver.php
- push_receiver.php needs to be uploaded to a publicly accessible URL
- edit PUSH_ENDPOINT in register_push to match the URL, and enter login details for the account
- run php register_push.php once to register your endpoint for push notifications
All URIs are relative to https://api.thelightbug.com/api
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DeviceApi | deviceFindById | GET /devices/{id} | Find a model instance by {{id}} from the data source. |
| DeviceApi | devicePrototypeCreateNotificationTriggers | POST /devices/{id}/notificationTriggers | Create alert/notification trigger for device |
| DeviceApi | devicePrototypeDeleteNotificationTriggers | DELETE /devices/{id}/notificationTriggers | Remove all alert/notification trigger for device |
| DeviceApi | devicePrototypeDestroyByIdNotificationTriggers | DELETE /devices/{id}/notificationTriggers/{fk} | Remove alert/notification trigger by id {fk} for device |
| DeviceApi | devicePrototypeDestroyByIdPoints | DELETE /devices/{id}/points/{fk} | Delete a specific point for a device |
| DeviceApi | devicePrototypeDestroyByIdTransients | DELETE /devices/{id}/transients/{fk} | Delete a related item by id for transients. |
| DeviceApi | devicePrototypeFindByIdNotificationTriggers | GET /devices/{id}/notificationTriggers/{fk} | Find a related item by id for notificationTriggers. |
| DeviceApi | devicePrototypeFindByIdPoints | GET /devices/{id}/points/{fk} | Retrieve a specific point for a device |
| DeviceApi | devicePrototypeFindByIdReadings | GET /devices/{id}/readings/{fk} | Retrieve a specific reading for a device |
| DeviceApi | devicePrototypeFindByIdTransients | GET /devices/{id}/transients/{fk} | Find a related item by id for transients. |
| DeviceApi | devicePrototypeFlightMode | GET /devices/{id}/flightMode | |
| DeviceApi | devicePrototypeGetConfig | GET /devices/{id}/config | Retrieve configuration for a device |
| DeviceApi | devicePrototypeGetNotificationTriggers | GET /devices/{id}/notificationTriggers | Get alerts for device |
| DeviceApi | devicePrototypeGetPoints | GET /devices/{id}/points | Retrieve points for a device |
| DeviceApi | devicePrototypeGetReadings | GET /devices/{id}/readings | Retrieve readings for a device |
| DeviceApi | devicePrototypeGetSafeZone | GET /devices/{id}/getSafeZone | Get safe-zone for device |
| DeviceApi | devicePrototypeGetTransients | GET /devices/{id}/transients | Queries transients of device. |
| DeviceApi | devicePrototypeSetSafeZone | POST /devices/{id}/setSafeZone | Update safe-zone for device |
| DeviceApi | devicePrototypeUpdateByIdNotificationTriggers | PUT /devices/{id}/notificationTriggers/{fk} | Update an alert/notification trigger by id {fk} for device |
| DeviceApi | devicePrototypeUpdateByIdTransients | PUT /devices/{id}/transients/{fk} | Update a related item by id for transients. |
| DeviceApi | devicePrototypeUpdateConfig | PUT /devices/{id}/config | Update configuration for a device |
| UserApi | userLogin | POST /users/login | Login a user with username/email and password. |
| UserApi | userPrototypeCreateGeofences | POST /users/{id}/geofences | Creates a new instance in geofences of this model. |
| UserApi | userPrototypeDeleteGeofences | DELETE /users/{id}/geofences | Deletes all geofences of this model. |
| UserApi | userPrototypeDestroyByIdGeofences | DELETE /users/{id}/geofences/{fk} | Delete a related item by id for geofences. |
| UserApi | userPrototypeFindByIdGeofences | GET /users/{id}/geofences/{fk} | Find a related item by id for geofences. |
| UserApi | userPrototypeGetDeviceSummary | GET /users/{id}/getDeviceSummary | Retrieve a summary of all devices on this user account. |
| UserApi | userPrototypeGetDevices | GET /users/{id}/devices | Queries devices of user. |
| UserApi | userPrototypeGetDevicesInZone | GET /users/{id}/getDevicesInZone | Retrieve a list of devices in any given zone or group of zones. |
| UserApi | userPrototypeGetGeofences | GET /users/{id}/geofences | Queries geofences of user. |
| UserApi | userPrototypeGetMqttCredentials | GET /users/{id}/getMqttCredentials | |
| UserApi | userPrototypeUpdateByIdGeofences | PUT /users/{id}/geofences/{fk} | Update a related item by id for geofences. |
- AccessToken
- Credentials
- Datapoint
- Device
- DeviceConfig
- DeviceTransient
- GeoPoint
- Geofence
- Notification
- NotificationTrigger
- SensorReading
Enter username and password in the examples. Login helper function is included in Helpers::login. See usage in gettings tarted