As you work with the Octopus API, you may need some guidance on how to perform certain actions or what parameters to provide. The OctopusDeploy-API GitHub repository contains many examples using the API, with solutions covering:
- PowerShell using the REST API.
- PowerShell using Octopus.Client.
- C# using Octopus.Client.
- Python using the REST API.
- Go using the Go API Client for Octopus Deploy.
- Java using the java-octopus-deploy Client.
- TypeScript using the TypeScript API Client for Octopus Deploy.
In addition, we also have a wide range of some of the more common examples here as well.
Using the scripts
To use the example scripts, you’ll need to provide your Octopus Server URL and an API Key. There may be other values that need to be updated to fit your scenario such as Space, Project, and Environment names.
The examples provided are for reference and should be modified and tested prior to using in a production Octopus instance.
The C# examples are written using dotnet script. The same logic can be used in a standard C# application.
Examples using Octopus.Client require the library to be installed and a path to the library to be provided.
The Go examples are written using the Go API Client for Octopus Deploy.
The Java examples are written using the java-octopus-deploy Client.
The Java Client library requires Java 1.8 or above.
The TypeScript examples are written using the TypeScript API Client for Octopus Deploy.
Sometimes you want to perform an action on a resource in Octopus multiple times. For example, connecting a tenant to all of your projects. Having to run a script that performs an operation once, repeatedly, can become tedious.
To help with this, we’ve included examples of bulk operations using the Octopus REST API.
Explore the REST API examples further in this section:
- Deployment process
- Deployment targets
- Project Groups
- Step Templates
- Tag sets
- Users and Teams
- Bulk Operations
Help us continuously improve
Please let us know if you have any feedback about this page.
Last updated Sunday, January 1, 2023