Add built in octopus step using api

Hello

I have written a powershell script that will allow us to add a set of steps to all projects. This works if i select action templates that we have written or that were provided by the community. However when i want to select a built in octopus template like “Manual Intervention Required” my script fails because i cannot find that template.

Below is example code that tries to find the template this fails because “Manual Intervention Required” is not found

$stepTemplateName = “Manual Intervention Required”
$actionTemplate = $repository.ActionTemplates.FindByName($stepTemplateName)
if ($actionTemplate.Id -eq $null)
{
throw “$($stepTemplateName) doesn’t exist”
}

when i loop through all templates inside ActionTemplates only templates that we wrote or the community provided show up. do you know how i can find the built in templates?

Thank you.

Fabian

Hi Fabian,

Thanks for getting in touch! Looking through our sample script repo, we don’t have any specifically for adding a manual intervention step, but the following script is to add a script step. Would this help point you in the right direction?

You can use your browser’s network tab to see the API calls that are made when you do things through the web portal. That may help as well to find the best way to call the API and what data to provide.

Alternatively, perhaps you could create a custom step template based on a built in step, which may then show up when looping through the ActionTemplates.

I hope this helps! Let me know how you go or if you have any further questions moving forward. :slight_smile:

Best regards,

Kenny

Hi Kenny

I was able to add the manual step thanks to your tip to check the browser’s network tab.

However i would still like to find a way to retrieve the properties of the built in steps dynamically and not have to hard code them after figuring out their names on the browser’s network tab.

Is there no object in the API that exposes built in templates like the ActionTemplates exposes custom templates?

Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.