traccar-web
traccar-web copied to clipboard
API/DEVICES
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.
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.
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.
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.