Hi I want to enable or disable an already scheduled trigger automatically by a powershell script as a process in my octopus project. By editing the “$TriggerAPI.IsDisabled = “True””/ $TriggerAPI.IsDisabled = “false” . While trying this I got Method not allowed error. Is it possible to edit the trigger state by a post method ? Help me please…
below is the script I have tried.
$TriggerAPI = Invoke-RestMethod -Uri $url -ContentType application/json -Headers @{“X-Octopus-ApiKey”="$octopus_apikey"} -Method Get -Verbose
(Trigger API GET) after changing the value IsDisabled to true or false
Invoke-WebRequest -Uri $url -Method POST -Headers @{“X-Octopus-ApiKey”="$octopus_apikey"} -Body $TriggerAPI .
Thanks for getting in touch! That’s great to hear you’ve gotten your script working as expected. I appreciate you letting us know the outcome to help people looking to do the same in the future. Please don’t hesitate to reach out if you have any further questions moving forward.