[help] Traccar api: Get devices: Device status column

brenthmiras 9 years ago

The route for getting devices (/api/devices) returns a list of device which contains a status field (whether online or offline).

But the devices table only has these columns:

+--------------+
| Field        |
+--------------+
| id           |
| name         |
| uniqueid     |
| lastupdate   |
| positionid   |
| groupid      |
| attributes   |
+--------------+

My question is, from what table do that route (/api/devices) fetches that status field?

Anton Tananaev 9 years ago

Status is not stored in the database. It indicates active network connection, so it doesn't make sense to persist it.

brenthmiras 9 years ago

If it is not stored in the database, then where does the route: (/api/devices) get that status field from?

Anton Tananaev 9 years ago

From the internal state in the server.

brenthmiras 9 years ago

Is it stored just in memory? So it (device status) will be deleted on server reboot?

Anton Tananaev 9 years ago

Yes, it doesn't make any sense to save it on reboot.

brenthmiras 9 years ago

Is there no way to access these status by a third party app?

Anton Tananaev 9 years ago

There is - through API.