What are the forward.url attributes?

Ihor Romanyshyn6 years ago

Ok, I'm trying to use Traccar as "GPS proxy" to pass location data to another tracking service as osmand format. My problem is GET request type instead of POST. How I can change it?

Here is part of config:

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://example.org:5055/?id={uniqueId}&amp;lat={latitude}&amp;lon={longitude}&amp;timestamp={deviceTime}&amp;hdop={accuracy}&amp;altitude={altitude}&amp;speed={speed}</entry>
Leif Neland5 years ago

If you haven't fixed it by now, I suggest firing up a small webserver to accept the GET request and send a POST request

HALI TRADE4 years ago

https://github.com/tananaev/traccar/blob/master/src/org/traccar/WebDataHandler.java

this link is offline.

Please write again where to find the attributes.

Anton Tananaev4 years ago

Just search for the file in the repo.

Ryan Cee3 years ago

Is there any way to forward the timestamp={} in a unix timestamp, when forwarded?

Adama year ago

For anyone looking this is the latest file location
https://github.com/traccar/traccar/blob/master/src/main/java/org/traccar/forward/PositionForwarderUrl.java

                .replace("{name}", URLEncoder.encode(device.getName(), StandardCharsets.UTF_8)) 
                 .replace("{uniqueId}", device.getUniqueId()) 
                 .replace("{status}", device.getStatus()) 
                 .replace("{deviceId}", String.valueOf(position.getDeviceId())) 
                 .replace("{protocol}", String.valueOf(position.getProtocol())) 
                 .replace("{deviceTime}", String.valueOf(position.getDeviceTime().getTime())) 
                 .replace("{fixTime}", String.valueOf(position.getFixTime().getTime())) 
                 .replace("{valid}", String.valueOf(position.getValid())) 
                 .replace("{latitude}", String.valueOf(position.getLatitude())) 
                 .replace("{longitude}", String.valueOf(position.getLongitude())) 
                 .replace("{altitude}", String.valueOf(position.getAltitude())) 
                 .replace("{speed}", String.valueOf(position.getSpeed())) 
                 .replace("{course}", String.valueOf(position.getCourse())) 
                 .replace("{accuracy}", String.valueOf(position.getAccuracy())) 
                 .replace("{statusCode}", calculateStatus(position));
SYSTADOa year ago

Any chance to have the eventcode forwarded as well (sos,overspeed etc)
In what variable will that be forwarded ?

And an up to date list of arguments?
No matter which i try in my forwardURL i only get stuff like this in my log

2024-02-07 07:33:31  INFO: [Tfcfde3e5] error - The template variable 'name' has no value - IllegalArgumentException (... < EventForwarderJson:41 < NotificationManager:141 < *:83 < *:155 < ConnectionManager:247 < ...)
Anton Tananaeva year ago

You cannot use template variables with JSON forwarding. In fact event forwarding doesn't support it at all.