API examples
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 REST API.
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.
C# examples
The C# examples are written using dotnet script. The same logic can be used in a standard C# application.
Octopus.Client examples
Examples using Octopus.Client require the library to be installed and a path to the library to be provided.
Python examples
The Python examples are written using Python 3 and use the Requests library.
Go examples
The Go examples are written using the go-octopusdeploy Client.
Explore examples
Explore the REST API examples further in this section:
- Accounts
- Certificates
- Channels
- Deployment process
- Deployment targets
- Deployments
- Events
- Feeds
- Lifecycles
- Project Groups
- Projects
- Releases
- Runbooks
- Spaces
- Step Templates
- Tag sets
- Tasks
- Tenants
- Users and Teams
- Variables
Need support? We're here to help.