event.forward.enable & event.forward.url

macphisto8 years ago

Hi Anton,

First thanks a lot for this great work and for still help us.

I tried to use the "event.forward.enable" and "event.forward.url", i putted this lines in the default.xml

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http:/www.dummy.com/api/listen_event</entry>

And i created a listener in laravel to read anything and store in a database. I checked using postman and works fine.

But when run traccar i dont read any event (in my laravel code). The question is? Is ok the lines added in default.xml? Do i need something special in the listener?

Any help will be appreciated.

Anton Tananaev8 years ago

You shouldn't modify default.xml, but otherwise it looks fine.

macphisto8 years ago

Thanks for answer

Where i can add this value if i can't modify the file?

macphisto8 years ago

Otherway

What kind of data it will expected in the other server?

Anton Tananaev8 years ago

Please read the official documentation:

https://www.traccar.org/configuration-file/

It sends data in JSON format.

macphisto8 years ago

Thanks is GET or POST?

abyss8 years ago

Hello,

POST

macphisto8 years ago

Thanks abyss.

I don't receive anything. Maybe i missed something.

How can i add header? What is the format? Where is detailed info to use this?

abyss8 years ago

You can check this pull-request https://github.com/tananaev/traccar/pull/2110

Also there was discussion https://github.com/tananaev/traccar/issues/2395

You can set header like this:


<entry key='event.forward.header'>
    Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
</entry>
macphisto8 years ago

Thanks Guys! Now working. Great Help!!!
Best Regards,

Atul8 years ago

Hello,

I am facing similar issue. I don't have any authorization. I looked at wireshark and it does not show any HTTP request. It looks like URL not getting called.

Below is how I configured in default.xml:

<entry key='event.enable'>true</entry>
<entry key='event.forward.url'>http://mywebsite/api/events/capture/</entry>

I have also tried added below and still it doesn't work.

<entry key='event.forward.header'> Content-Type: application/json; charset=utf-8 </entry>

There's no information in log. I however get an email for the event that I configured. So the events is working fine, its just that it doesn't call the URL I specified.

What could be wrong?

Thanks,
Atul

Anton Tananaev8 years ago

It should be working. Your config looks fine. Although you should be changing "traccar.xml", not "default.xml". Try to forward the data to Traccar port 5055 to see if it sends anything.

abyss8 years ago

Which page exactly should be posted http://mywebsite/api/events/capture/ ?

Atul8 years ago

Thanks for your response. I tried changing the traccar.xml and sending data to 5055 port, still same behavior. As I mentioned, I do get email for events such as Online/Offline/Geo-fence Enter/Exit, but does not call API URL.

@abyss - Its just a API URL that I am using to post data which I can capture and do some action. I can see other HTTP APIs been called in Wireshark except this.

Is there any log which can give me more information about this or am I missing something basic?

Please let me know.

Thanks,
Atul

Atul8 years ago

By the way I have also used below in traccar.xml which works fine

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>

Thanks,
Atul