Device online/offline via API

Fordsman9 years ago

How can i determine on web interface if the device is online and sending data? If use API Live, api/async, i get all devices not only data from online devices

Anton Tananaev9 years ago

There is no way to check connection status in current version, but I plan to add this functionality at some point.

Malkit Singh8 years ago

Any update on this @Anton ? Is this added in 3.8 version? How do you detect if device is online or offline?

Anton Tananaev8 years ago

It has been available in Traccar for a while now.

Malkit Singh8 years ago

which api service gives this information?

Anton Tananaev8 years ago

Get devices service call returns that information.

Malkit Singh8 years ago

oh got it.
@Anton, I just downloaded updated swagger.json file and need little help in understanding input format of various requests. (By the way, it would have helpful if you would create swagger file with example inputs -- I will try to make this version of swagger file for demo server, if not swagger then POSTMAN collection for sure.)

Ok here are services name and few questions about them.

  1. Posistions api

    http://traccar.org/api/positions?deviceId={{deviceId}}&from={{from}}&to={{to}}&id={{id}}
    

    A. what should I pass in id parameter ( the last one ) ?
    B. from and to parameters must expect date time I guess. What's the correct format of date time value for this? Example please.

  2. Respors api's - almost every request in this set of API's requires group id to be sent, will it not work without group id?

    http://traccar.org/api/reports/route?deviceId={{deviceId}}&groupId={{groupId}}&from={{from}}&to={{to}}
    http://traccar.org/api/reports/events?deviceId={{deviceId}}&groupId={{groupId}}&type={{type}}&from={{from}}&to={{to}}
    http://traccar.org/api/reports/summary?deviceId={{deviceId}}&groupId={{groupId}}&from={{from}}&to={{to}}
    http://traccar.org/api/reports/trips?deviceId={{deviceId}}&groupId={{groupId}}&from={{from}}&to={{to}}
    

    Same questions for all reports api's.
    A. what would be the format for input in from and to parameters.
    B. Is it must to pass group id?

I tried to run these api's but I ended up getting errors, I am sure I tried with wrong input for from and to parameters. Here is what date time format I was trying 2016-12-04 06:09:20

Thanks.

Anton Tananaev8 years ago

1A. It's an "id" of the position
1B. ISO date format
2A. ISO date format
2B. It's an optional parameter. You only pass it if you want report for a group of devices

Malkit Singh8 years ago

for 1A, don't you think it is confusing, why should I pass position id to get positions of given device id?

Anton Tananaev8 years ago

You don't have to. The same URL path can give you either all positions for selected device, current positions for all user device, or specific position. All parameters are optional.

Malkit Singh8 years ago

oh that makes sense. Thanks for clearing all these doubts. I will share postman collection soon.