Generating a Variable Report via Octopus REST API / Octopus Client

Hi,

I’m curious how to go about generating a report capturing the variable values for a specific project, environment and tenant. I’ve been exploring the rest api via swaggerui and looking into the Octopus Client powershell library as well. Does anyone have a code sample or know of which rest calls I can use to accomplish this?

Hi Jason,

Thanks for getting in touch!

We have a sample script repository available here that is a good starting place when working with the REST API: GitHub - OctopusDeploy/OctopusDeploy-Api: Documentation for the Octopus Deploy HTTP API

I don’t think we have an exact script for this, but one that could be a good base is this one:

It doesn’t include filtering for Tenants though, so, would need some additional work to reach what you need.

Another good resource to use when scripting on the REST API is the developer tools within your browser. All of the actions that you can take within the Octopus UI are accomplished using the REST API, so, you can often check the requests being made as you perform an action to get a good idea for what your script will need.
So, checking out the request made when using the Preview option within Project > Variables could help.

Regards,
Paul

Thanks, I’ll give that a try

1 Like

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