Powershell script to import a Step Template

Hi,
Is there a way to Import a Step Template using powershell?

Thanks,
Mike

Hey Mike,

Thanks for reaching out.

As Octopus is an API driven product, you can do mostly anything with API calls within Octopus.

Here are a few useful resources to get you started:

SwaggerUI: If you add /swaggerui to the end of your octopus server url, you will get taken to a page where you can see all of the API calls available to you with explanations of how to use them.

In your case, you would likely need to look at the actiontemplates section.

Developoer Tools in Browser: If you want to get a good sense of the process required for you to manually achieve something with API calls, a good place to start is to open Developer Tools(F12). Once open, go to the Network tab. Now, in the Octopus Portal, click through the process that you want to achieve with API calls and watch the API calls that take place. These will give you a good idea of how you will need to build your script.

Octopus API Example Repository: This is our repository of API examples. Sometimes you will find a script already exists that does what you need, but other times you can probably find something close to it to adapt to your own script.

In your instance, I found this example. It’s in C# using the Octopus.Client, but you should be able to use similar syntax to adapt it to powershell.

Please let me know if this was helpful or if you need more information.

Thanks,
Jeremy

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