traccar-web icon indicating copy to clipboard operation
traccar-web copied to clipboard

API/DEVICES

Open allanqm opened this issue 7 years ago • 3 comments

Good Night,

Json's address http://xxx.xxx.xxx.xxx:8082/api/devices is not bringing me the value of the phone field.

The result is:

[{"id":2,"attributes":{},"name":"JR Celular","uniqueId":"478213","status":"unknown","lastUpdate":"2018-01-11T18:49:30.492+0000","positionId":2237,"groupId":0,"geofenceIds":null,"phone":null,"model":null,"contact":null,"category":null},{"id":3,"attributes":{},"name":"Magno Moto Trilha","uniqueId":"864180034307021","status":"offline","lastUpdate":"2018-01-11T21:08:30.213+0000","positionId":2388,"groupId":0,"geofenceIds":null,"phone":null,"model":null,"contact":null,"category":null},{"id":5,"attributes":{},"name":"Novo Uno Magno","uniqueId":"864180034263001","status":"offline","lastUpdate":"2018-01-12T00:47:24.305+0000","positionId":2496,"groupId":0,"geofenceIds":null,"phone":null,"model":null,"contact":null,"category":null}]

The field phone appears the result null. Which file do I need to modify to resolve this query? I need this value for my project.

Very thanks.

Traccar 3.9 - Web UI

Sorry for my English, im Brazilian.

allanqm avatar Jan 12 '18 04:01 allanqm

This API is not supported when you are using the Traccar Web UI Mod. This API is from traccar backend. The phone in web UI is called "phoneNumber", so I guess you can update the "selectDevices" query in traccar.xml somehow with column aliases to map phoneNumber column to phone in the query. Then you should be able to get the needed field in JSON.

vitalidze avatar Jan 14 '18 08:01 vitalidze

Very, very thanks.

I edited the selectDevices key from default.xml by inserting the phonenumber as phone and it worked.

What are the column names? "geofenceIds": null, "model": null, "contact": null, "category": null

The result of them is also being null. I would like to try the same resolution, but I can not find their names on the call.

allanqm avatar Jan 15 '18 22:01 allanqm

geofenceIds seems to be a list of associated geo-fences. From my knowledge It's not possible to load them in a single row.

Others seems to be static and I think you can match the by running SQL query against your database.

vitalidze avatar Jan 16 '18 05:01 vitalidze