Event Forwarding appends ampersand before JSON data

Michael B 7 years ago

Hello,

First, to warn, I am not a programmer and knowledge of url query strings/headers/json is very limited.

I am trying to configure event forwarding to another service, other service expects POST data in the form:

http://localhost/phl2api?dtype=TF&data=

Where the json data follows immediately after 'data='.

I have the following in conf/traccar.xml:

<entry key='event.forward.url'>http://localhost/phl2api?dtype=TF&amp;data=</entry>

But in the logs of the receiving service I see this:

(phlapi) POST Error: Error! Empty data string.

and

phl2api POST Data Received: dtype=TF&data=&{"event":{"id":1227,"attri....

That extra ampersand immediately after 'data=' causes the data parameter to appear empty.

Can someone please help me, what is the correct formatting to use? I'm aware I may be missing something that may seem very fundamental and basic to others, so thank you for your patience.

Anton Tananaev 7 years ago

What you are asking is not possible at the moment. JSON data is sent in the request body, not query parameter.