Skip to content

Quickstart

This quickstart shows the minimum flow to authenticate and fetch device status. For full auth details, see Authentication.

1. Set credentials

bash
export TOKEN_URL="https://<auth-host>/realms/<realm>/protocol/openid-connect/token"
export CLIENT_ID="YOUR_CLIENT_ID"
export CLIENT_SECRET="YOUR_CLIENT_SECRET"
export API_BASE_URL="https://<api-host>/api/<version>"

2. Request an access token

bash
ACCESS_TOKEN=$(curl -s -X POST "$TOKEN_URL" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET" | jq -r '.access_token')

3. Call the device status endpoint

bash
curl -s "$API_BASE_URL/devices/status" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

4. Example response

json
{
  "status": true,
  "message": "Success",
  "data": {
    "count": 2,
    "rows": [
      {
        "id": 101,
        "name": "Store Entrance Camera",
        "network": { "id": 1, "name": "Retail Network A" },
        "site": { "id": 5, "name": "CBD Store" },
        "location": { "id": 12, "name": "Entrance" },
        "status": "online",
        "last_active_timestamp": "2026-03-30T04:10:00.000Z",
        "source": "heartbeat"
      }
    ]
  }
}

5. Interpret status

  • online: heartbeat received.
  • offline: no heartbeat received.

Next step

Use optional query parameters like site_id and location_id to filter results.