Send osmand data from linux command line

Vladimir S6 years ago

Hi, is there any way to send data directly from linux command line to traccar server? Curl command not working properly, only browser.
example:

curl "http://traccarserver:5055/?id=1100101&lat=48.163142&lon=47.178735&altitude=4&speed=5"

this command only updates last update time but attributes are still same..

Thanks a lot for help

Anton Tananaev6 years ago

There shouldn't be any difference.

Vladimir S6 years ago

i have tried to copy request as curl with chrome developer tools.. it will send identical request to server.. hex is identical too..but data is not used in traccar.

Vladimir S6 years ago

I have found workaround.. this command server receive data and change it properly..

curl "http://traccarserver:5055/?id=1100101&lat=48.163142&lon=47.178735&altitude=4&speed=5" --ignore-content-length -m 0.5

Hello guys,

I am developing a tracker based on ESP32, with httpClient library.
I spent last 12 hours trying to find the reason my POST to OsmAnd protocol was not used for updating data (only "last update time" was updated).
Vladimir's workaround clears the horizon, but seems to be a bug on Traccar or Java's libraries. Furthermore, why the protocol is "POST", since clearly we are using "GET" to "send" the values to server with empty body (POST data)?

By the way, thanks for the incredible piece of software you have created!

Anton Tananaev5 years ago

Both POST and GET should work. Both query parameters and body parameters are supported as well.

Thank you very much for your quick reply.

Using all this information I was able to solve my problem and I'd like to share, at least for the httpClient library (for boards ESP32, ESP8266)...

http.POST("?id=12345×tamp=1563129868&lat=-30.100675&lon= -51.262190&altitude=44");  //this alone wont update data on server
http.POST("");   //this second POST makes the data to be processed (you don't need to connect as "keep-alive" for that to work)
  • Writing enter (\n) character on the first POST does not do the job, also.
Vladimir S5 years ago

Hi Adriano,

i am trying your solution, but without success.

curl "http://myserver:5055/?id=111111&lat=48.163107&lon=17.178840&hdop=7&altitude=456&speed=123&test=100" && curl "http://myserver:5055"

Still updating only date/time but no data...

5of95 years ago

This problem still exist! There is no failure notice in log but it only updates the times nothing else

Guy4 years ago

Hi everyone,

It is my first time here and I want to say that this software is amazing!
After testing with the Apps, now I am adding Mikrotik LtAP routers and I have encountered the same problem that you are commenting on. Although all OsmAnd parameters are received correctly in Traccar (it appears correct in the log), only the time is updated.

Traccar LOG after decoding:

GET /?id=111111&lat=39.470881&lon=5.055720&altitude=116.500000&speed=0.518560 HTTP/1.1
Host: traccar.mydomain.com
Connection: close
user-agent: Mikrotik/6.x Fetch
Content-Type:  application/x-www-form-urlencoded

I have tried everything and read many forums, but there is no way for Traccar to update latitude, longitude, altitude and speed values.

For now the only solution I have found is to send the data to an intermediate server and use Vladimir's workaround --ignore-content-length -m 0.5 by sending the data with curl to Traccar. But this is not how it should work.

Anton, could it be that there is a bug in Traccar that causes the data not to be stored except the time as Adriano comments?

We can make some test together if you want.

Thanks for all!

Anton Tananaev4 years ago

Do you have corresponding log fragment?

Guy4 years ago

Thanks for your quick response!

Here you have the log.

2020-10-07 19:31:15  INFO: [640e028a] connected
2020-10-07 19:31:15  INFO: [640e028a: osmand < 85.49.24.89] HEX: 474554202f3f69643d313131313131266c61743d34312e343730383239266c6f6e3d322e30353537393326616c7469747564653d3133302e3830303030332673706565643d302e35333730383020485454502f312e310d0a486f73743a20747261636b2e64656c66796e65742e636f6d0d0a436f6e6e656374696f6e3a20636c6f73650d0a757365722d6167656e743a204d696b726f74696b2f362e782046657463680d0a436f6e74656e742d547970653a20206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a0d0a
2020-10-07 19:31:16  INFO: [640e028a: osmand > 85.49.24.89] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2020-10-07 19:31:16  INFO: [640e028a] disconnected
Anton Tananaev4 years ago

The problem is that the connection is closed instantly. Do you have geocoding or forwarding enabled? Try disabling it.

Guy4 years ago

You are right!!
I disabled geocoding and now all data is correctly registered.
There is any way that it also work with geolocation enabled?

Thank you very much!

Anton Tananaev4 years ago

We haven't found a way yet.