Last active
August 29, 2015 14:12
-
-
Save Dalmirog-zz/21ad5eeadca29c3e8ec1 to your computer and use it in GitHub Desktop.
Octopus - Delete LifeCycle using REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Change dll path accordingly | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Platform.dll" | |
#Connection data | |
$apikey = "YOUR-API" | |
$OctopusURI = "http://YourOctopusURL" | |
$headers = @{"X-Octopus-ApiKey"="$($apikey)";} | |
$endpoint = new-object Octopus.Client.OctopusServerEndpoint "$($OctopusURI)","$($apikey)" | |
$repository = new-object Octopus.Client.OctopusRepository $endpoint | |
#I.e "Lifecycles-2" (Open the lifecycle you want to delete from the Web UI and check the URL if unsure of this value) | |
$LifecycleID = "" | |
Invoke-WebRequest -Uri $octopusURI/api/lifecycles/$LifecycleID -Method Delete -Headers $headers -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment