API application/gpx+xml

Mirko M.6 years ago

Hi,

I recive this error:

NullPointerException (PositionResource:90 < ...)

when i execute this:

curl "https://track.mysite.it/api/positions" -H "authorization: Basic myAuth" -H "accept: application/gpx+xml"

this works:

curl "https://track.mysite.it/api/positions" -H "authorization: Basic myAuth" -H "accept: application/json"

can someone help me?

thanks!

Ernesto Vallejo6 years ago

Try leaving accept header empty.

Mirko M.6 years ago

Empty is the same of application/json
I use gpx+xml for obtain gpx

Anton Tananaev6 years ago

For GPX you need to provide device id, from and to values.

Mirko M.6 years ago

i have just try but the problem is the same

curl "https://track.mysite.it/api/positions" -H "authorization: Basic myAuth" -H "accept: application/gpx+xml" -H "from: 2019-03-21T08:00:00Z" -H "to: 2019-03-21T13:00:00Z" -H "deviceid: myDeviceId"
NullPointerException (PositionResource:90 < ...)
Anton Tananaev6 years ago

I think you should read documentation a little bit more.

Mirko M.6 years ago

ok, I'll read the documentation again.
thank you

Mirko M.6 years ago

SOLVED

thanks for the help and work you've done. sorry for the newbie question.

curl "https://track.mysite.it/api/positions?deviceid=myDeviceId&from=2019-03-21T08:00:00Z&to=2019-03-21T13:00:00Z" -H "authorization: Basic myAuth" -H "accept: application/gpx+xml"
VACHEZ JEROME5 years ago

Hello !

When I type your last command in Windows command line I receive a connection refused error.

Maybe it works only in a full php or python script.

Can someone provide the code he uses to download a gpx file ? I will replace url, deviceid, from and to download my file.

zhaofeng-shu334 years ago
XauMasala4 years ago

I'm trying the comand indicated by Mirko M. two years ago, with the "accept: application/gpx+xml" header:

curl "http://my.server.org:8072/api/positions?deviceId=3&from=2021-04-07T00:00:00.000Z&to=2021-12-31T23:59:59.000Z" -H "authorization: Basic myAuthorization" -H "accept: application/gpx+xml"

but I get the error:

HTTP 406 Not Acceptable - NotAcceptableException (...)

If I send the command using header "accept: application/json" the command executes correctly (returning json format), so the call is correctly formatted and the connection is correct, but I can't get the GPX format.

Is still supported the "application/gpx+xml" format to get a GPX file? What am I missing?

Anton Tananaev4 years ago

What version are you using? It has been removed recently.

XauMasala4 years ago

I'm using traccar as a Home Assistant Add-on. The traccar version is v4.12.

XauMasala4 years ago

Also tried https://demo3.traccar.org/ with the same result. I don't know wich version is installed in the demo server.

If this functionality has been removed, is there any way to export gpx or similar format?

Anton Tananaev4 years ago

You can export in JSON via API.