Hello,
I’m working on creating/updating device environment variables via the API (I’d actually like to create device service variables, but that requires more info, including something called a “service_install”, which I can’t find an explanation of… I digress).
If I try to POST a variable to a device that already has it set, I get an error. In order to update that existing variable, I have to know the exact ID of the device environment variable. That turns one request into three:
- Try the POST
- POST fails, so GET all existing variables and loop through to find the existing one
- PATCH the existing variable
I suppose this could be shortened to the following:
- GET all variables and look through to see if it is set
- POST or PATCH depending on whether or not it exists
But then I’m always doing 2 requests, which is not ideal (though certainly not a show-stopper). Is there a way to do it in one fell swoop? In my opinion, a POST should just clobber anything that is already set.