API for updating variables in a release?

Hi,

I’m using 1.6.3.1723 and need to re-deploy a release after updating variables programmatically. I know it’s possible via the UI, but is there a way to achieve this via the API?

Thanks,
Mike

Hi Mike,

No, in 1.X there’s no way to do this via the API unfortunately. It is supported in Octopus 2.0 however.

Paul

Hi Paul,

Great thanks. In the meantime I have a work around via powershell to force the variable refresh.

$logInPage = Invoke-WebRequest -Uri "https://${server}/accounts/login" -SessionVariable octoSession
$token = @($logInPage.ParsedHtml.getElementsByName("__RequestVerificationToken")).Value

$post = "__RequestVerificationToken=${token}&Username=${username}&Password=${password}&StayLoggedIn=false"	
Invoke-WebRequest -Uri "https://${server}/accounts/login" -Body $post -WebSession $octoSession -method POST
Invoke-WebRequest -Uri "https://${server}/projects/${project}/releases/${release}/updatevariables" -WebSession $octoSession -method POST

Thanks,
Mike