API - PUT /devices/{id} - Why do we post all parameters

jaimzj6 years ago

When using Traccar API to update a device, the official web version, posts all parameters including the following parameters mentioned below while editing a device.
Although the edit option/form does not allow user to modify any of these values, and these values are real-time based on current state of device updated by traccar itself.

Why are they also required to be posted? would it not be safe to remove these from being modified by / via API ? please advise.

geofenceIds / lastUpdate / positionId / status

Anton Tananaev6 years ago

That's just how it works. Missing field means it's NULL, so there is no way to distinguish between not modified and null when you don't send unchanged fields.

jaimzj6 years ago

I understand your point. Would it be considered in future to have a condition in the system to not update fields that is not defined for the device (specially for device api the above fields)

My reasoning behind it is, do we need to modify geofenceIds or status value from API. When traccar back-end handles it and updates it in real-time.

I do understand lastUpdate & positionId still can be modified to cover certain issues such as admins who might have not configured the future timestamp filter and then wanting to modify those values.

Anton Tananaev6 years ago

Feature requests should be on GitHub.