Gitlab Api Project Variables

updating variables with gitlab api

In gitlab have variables set for my project like DEPL_TO_HOSTNAME. To deploy to different server is use environments and have this DEPL_TO_HOSTNAME variable set for staging and a second DEPL_TO_HOSTNAME for production.

I try to edit these variables with the gitlab api using a put to https://gitlab.com/api/v4/projects/:key_replaced/variables/DEPL_TO_HOSTNAME with the enviroment scope set to “production” and a new value. I however get an error message: “(DEPL_TO_HOSTNAME) has already been taken”. In the editor i can edit these variables just fine.

So how do i update these variables? Can i send something like a patch to update them all?

thanks for the help.