Http request from Traccar

Karlito 10 months ago

Hello,
I use traccar in docker with 2 st901 tracker and it works very great (sorry for my english, i'm french :) )
My final goal is to open a door (fibaro home center box) when i'm entering in a traccar's virtual area.
For this i need to send an http request from traccar to home venter box.
I've got several tracker ans several area.
Have you got a syntax for me please ?
Thank for this incredible work !!!
Karl

Anton Tananaev10 months ago

You can probably use event forwarding to achieve it.

Karlito 10 months ago

Ok, thanks.
I'm looking in that direction

Karlito 9 months ago

Hello,
it's me again...sorry to be a pain but i can't do this : send an http request from traccar when i'm entering in the area.
i'm looking for event forwarding, try sms notification and so on.
i don't find an simple exemple because i don't need "header" or other thin, just send an line like http:\192.xxx.x.xxx\switch4_on or something like that.
Somebody ever do it ?
thanks for help.
Karl

Anton Tananaev9 months ago

If you don't need header, don't specify header. I don't understand what the problem is.

Karlito 9 months ago

the problem, traccar server doesn't send the http request, my traccar.xml ( a part) :

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http://user:pass@192.168.x.xxx/preset.htm?RLY6=1</entry>

not working :(

Anton Tananaev9 months ago

The URL is not valid. You can't send a username and password like that.

Karlito 9 months ago

Hi Anton,
finally, i need authentification...i'm learnig about it :)
in traccar server, in notification, when i clic test channel (with "entered geofence" and "web" channel), normally, traccar sent the event forwarding ?

Thanks
Karl

Karlito 9 months ago

...with my traccar.xml setting :

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://192.168.x.xxx/api/callAction?deviceId=354&name=turnOn</entry>
<entry key='forward.json'>true</entry>

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http://192.168.x.xxx/api/callAction?deviceId=354&name=turnOn</entry>
<entry key='event.forward.header'>
    content-type: application/json,
    authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxx
    cache-control: no-cache
</entry>
Anton Tananaev9 months ago

Testing notifications doesn't generate an event. It only generates a notification. It can't be used for testing forwarding.

Karlito 9 months ago

Ok, thanks.
i'll waiting to move with my car to test it :)
you think it can work with this syntax ?

Karl

Anton Tananaev9 months ago

You don't really need content-type or cache-control, but it shouldn't hurt.