api for position history

Which api is to be used to fetch the position history of either one or all devices?

When I try according to the docs at https://www.traccar.org/api-reference/#path--positions the following queries should return the list of positions during the requested time period:

https://myserver/api/positions?from=2019-01-11T22%3A00%3A00Z&to=2019-01-12T22%3A00%3A00Z

or

https://myserver/api/positions?from=2019-01-11T22%3A00%3A00Z&to=2019-01-12T22%3A00%3A00Z&deviceId=1

but the 1st returns the only last known position of each device, and the 2nd doesn't return anything

When I look at the web client it uses the following (undocumented) api:

https://myserver/api/reports/route?_dc=1547346208225&deviceId=2&groupId=1&type=allEvents&from=2019-01-11T22%3A00%3A00.000Z&to=2019-01-12T22%3A00%3A00.000Z&page=1&start=0&limit=25
Anton Tananaev5 years ago

You should be able to use second version of your request. Route report is another option which basically returns the same data.