Edit device with json in URL.

Lykourgos 6 years ago

Hi i am trying to edit a device but i am trying to do it by sending the json data in the URL.
I am using this tool to encode the data, bellow i have an example of the url

traccardomain.com:6050/api/devices/1?body=%7B%0A%20%20%20%20%22id%22%3A%201%2C%0A%20%20%20%20%20%20%20%20%22attributes%22%3A%20%7B%7D%2C%0A%20%20%20%20%20%20%20%20%22groupId%22%3A%202%2C%0A%20%20%20%20%20%20%20%20%22name%22%3A%20%22reducted%22%2C%0A%20%20%20%20%20%20%20%20%22uniqueId%22%3A%20%22reducted%22%2C%0A%20%20%20%20%20%20%20%20%22status%22%3A%20%22online%22%2C%0A%20%20%20%20%20%20%20%20%22lastUpdate%22%3A%20%222020-06-12T18%3A06%3A11.370%2B0000%22%2C%0A%20%20%20%20%20%20%20%20%22positionId%22%3A%20354085%2C%0A%20%20%20%20%20%20%20%20%22geofenceIds%22%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%20%20%22phone%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%20%20%22model%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%20%20%22contact%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%20%20%22category%22%3A%20null%2C%0A%20%20%20%20%20%20%20%20%22disabled%22%3A%20true%0A%7D

but i receive the following responce : HTTP 405 Method Not Allowed - NotAllowedException (...)
I have tried sending the request via postman with the data in the body just like the web app does it and it works. But i am trying to connect traccar to bitrix24 and it can only connect to webhooks via URL. Any ideas what am i doing wrong ?
Thank you for your time.

Anton Tananaev 6 years ago
  1. You have to send request as PUT request, not GET.
  2. JSON has to be in the body. You can't send it as a query parameter.
Lykourgos 6 years ago

Thank you for the quick response and the usefull information.
Is there a way to enable and disable the device via URL request ?
If there isn't a way such a feature would be extremely usefull to connect traccar directly to other platforms.

Anton Tananaev 6 years ago

Not possible at the moment.