Skip to content

Get Objects

Retrieve a list of devices (objects) visible to the authenticated user. This endpoint provides comprehensive information about each device including connection status, hardware details, and session history.

Request

http
GET /api/objects

Authentication Required: Must include JWT token in Authorization header.

Required Scope: objects

Request Example

bash
curl -X GET "http://your-server-ip:port/api/objects" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response

Success (200 OK)

json
{
  "objects": [
    {
      "id": 123,
      "partial_uid": 456789,
      "oid": 987654,
      "uid": "AABBCCDDEEFF",
      "registered_at": "2025-10-18T12:34:56+02:00",
      "iccid": "1234567890123456789",
      "signal_level": 4,
      "com_type": 1,
      "con_type": 2,
      "ip": "192.168.1.100",
      "ping_interval": 60,
      "sms_ping_interval": 120,
      "hw_type": 1,
      "fw_version": "1.2.3",
      "receiver_id": 1,
      "receiver_nr": 2,
      "line_nr": 3,
      "last_activity": 1634567890,
      "status": 1,
      "last_sms_activity": 1634567891,
      "has_received_sms": true,
      "cloud_access_code": "XYZ123",
      "info_update_needed": false,
      "dev_receiver_nr": 1,
      "dev_line_nr": 2,
      "oid_override": 0,
      "next_time_update": "2025-10-19T12:00:00+02:00",
      "session_log": {
        "sessions": [
          {
            "start_time": 1634567890,
            "duration": 3600,
            "close_reason": 1
          },
          {
            "start_time": 1634564290,
            "duration": 1800,
            "close_reason": 0
          }
        ],
        "average_session_time": 2700
      },
      "related_objects": [
        {
          "id": 124,
          "oid": 987655,
          "uid": 789012,
          "status": 1,
          "last_activity": 1634567890,
          "device_id": 123,
          "oid_override": 0,
          "ping_interval": 60,
          "dev_receiver_nr": 1,
          "dev_line_nr": 2,
          "area": 1
        }
      ],
      "module_id": 42
    }
  ]
}

Response Fields

Main Object Fields

FieldTypeDescription
idintegerID in database
partial_uidintegerPartial unique identifier
oidintegerObject identifier
uidstringFull unique identifier (hex format)
registered_atstringISO 8601 timestamp when device was registered
iccidstringSIM card ICCID number
signal_levelintegerSignal strength level (0-10)
com_typeintegerCommunication type identifier (see Communication Types)
con_typeintegerConnection type identifier (see Connection Types)
ipstringDevice IP address
ping_intervalintegerPing interval in seconds
sms_ping_intervalintegerSMS ping interval in seconds
hw_typeintegerHardware type identifier
fw_versionstringFirmware version
receiver_idintegerReceiver ID
receiver_nrintegerReceiver number
line_nrintegerLine number
last_activityintegerUnix timestamp of last activity
statusintegerDevice status (see Device Status Values)
last_sms_activityintegerUnix timestamp of last SMS activity
has_received_smsbooleanWhether device has received SMS
cloud_access_codestringCloud access code
info_update_neededbooleanWhether device info needs updating
dev_receiver_nrintegerDevice receiver number
dev_line_nrintegerDevice line number
oid_overrideintegerOID override value (0 if not overridden)
next_time_updatestringISO 8601 timestamp for next scheduled update
module_idintegerModule identifier for SIA DC-09

Session Log Object

FieldTypeDescription
sessionsarrayArray of device session objects
average_session_timeintegerAverage session duration in seconds

Device Session Object

FieldTypeDescription
start_timeintegerUnix timestamp when session started
durationintegerSession duration in seconds
close_reasonintegerReason why session ended (see Session Close Reasons)
FieldTypeDescription
idintegerRelated object ID
oidintegerRelated object OID
uidintegerRelated object UID
statusintegerRelated object status (see Device Status Values)
last_activityintegerUnix timestamp of last activity
device_idintegerParent device ID
oid_overrideintegerOID override value
ping_intervalintegerPing interval in seconds
dev_receiver_nrintegerDevice receiver number
dev_line_nrintegerDevice line number
areaintegerArea identifier

Device Status Values

ValueDescription
0Online
1SMS mode
2Offline
3Untracked

Session Close Reasons

ValueDescription
0Unknown
1Timeout - Device tracker closed the session
2Client disconnect - Module closed the session itself
3New session - Old session remained open when module connected with new session
4Object deleted - Session closed due to object deletion

Communication Types

ValueDescription
0Device too old to report this information
1GSM
2LAN
3WiFi
4SigFox

Connection Types

ValueDescription
0None
1TCP
2UDP
3SMPP
4COM
5Modem

Error Responses

All error responses are returned as plain text:

401 Unauthorized

NOT_LOGGED_IN

403 Forbidden

FORBIDDEN

503 Service Unavailable

Database is not ready

405 Method Not Allowed

Method Not Allowed

Filtering and Visibility

User-Based Filtering

Objects returned are filtered based on the authenticated user's visible_receivers configuration:

  • If visible_receivers.all is true, user sees all objects
  • If visible_receivers.all is false, user only sees objects from receivers listed in visible_receivers.custom

Example Filtering Scenarios

Admin user (sees all receivers):

json
{
  "visible_receivers": {
    "all": true,
    "custom": []
  }
}

Limited user (sees only specific receivers):

json
{
  "visible_receivers": {
    "all": false,
    "custom": [1, 3, 5]
  }
}

Usage Examples

Get All Objects

bash
curl -X GET "http://your-server:8080/api/objects" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response Processing (JavaScript)

javascript
async function getObjects() {
  try {
    const response = await fetch('/api/objects', {
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      }
    });
    
    if (!response.ok) {
      const error = await response.text();
      throw new Error(error);
    }
    
    const data = await response.json();
    
    // Process objects
    data.objects.forEach(obj => {
      console.log(`Device ${obj.id}: ${obj.uid} - Status: ${obj.status}`);
      
      // Check session history
      if (obj.session_log && obj.session_log.sessions.length > 0) {
        console.log(`Average session time: ${obj.session_log.average_session_time}s`);
      }
      
      // Process related objects
      if (obj.related_objects && obj.related_objects.length > 0) {
        console.log(`Has ${obj.related_objects.length} related objects`);
      }
    });
    
    return data.objects;
  } catch (error) {
    console.error('Failed to fetch objects:', error);
    throw error;
  }
}

Filter Online Devices

javascript
function getOnlineDevices(objects) {
  return objects.filter(obj => obj.status === 1);
}

Get Devices with Recent Activity

javascript
function getRecentlyActiveDevices(objects, hoursAgo = 24) {
  const cutoffTime = Math.floor(Date.now() / 1000) - (hoursAgo * 3600);
  return objects.filter(obj => obj.last_activity > cutoffTime);
}

Important Notes

  • Scope Required: Users must have the objects scope to access this endpoint
  • Visibility Filtering: Only objects from receivers visible to the user are returned
  • Plain Text Errors: Error responses are not in JSON format
  • Session Logs: May be empty for devices with no recorded sessions
  • Related Objects: Can be an empty array if no related objects exist
  • Timestamps: Unix timestamps are used for time-based fields
  • Hardware Types: Hardware type values depend on device manufacturer specifications

Released under the MIT License.