Managing Variable using RestAPI

Hello everyone, I am currently trying to optimize the way we are using variable by putting them into config file in our projects and synchronizing them via the rest api.

So using the swagger ui I can’t find a way to delete a variable in a variable set…
I also tried a few DELETE based on how the route are made with no luck
I also looked how the ui handle it with POST but it seems we also don’t have access

Is there something i am missing
its seems to be hard for no reason at the moment

Hi @robin.lamarre,

First of all welcome to the Octopus Forums!

Thanks for reaching out.

To delete a variable from a variable set, you would actually need to use the API to bring down the variable set, then iterate through the variable set to find the desired variable, remove it from the object, and then use a PUT call to put the resource (with the removed variable) back into place.

Please let me know if you are able to get it going with this advice or if you need further help.

Thanks,
Jeremy

Works perfectly!
Thank you

1 Like

Awesome! You’re very welcome!

Thank you for letting me know you got it going.

I hope you have a great rest of your week.

Best,
Jeremy