Octopus Deploy Documentation

JSON Formatted Output

Last updated

Introduced in Octo.exe version 4.30.0, most commands support printing the result in JSON format.

Dump Deployment, Export and Import do not support JSON output.

To access JSON formatted output, use the --outputformat=json parameter.

octo list-projects --server http://your-octopus-server/ --apiKey API-ABCDEF123456 --outputformat=json

This command will output the list of projects in parsable JSON format:

[
  {
    "Id": "Projects-81",
    "Name": "Phoenix"
  },
  {
    "Id": "Projects-61",
    "Name": "OctoFX"
  },
]

You can also work with the JSON output in PowerShell

$json = (./octo list-releases --server http://your-octopus-server/ --apikey API-ABCDEF123456 --project=OctoLifecycle --outputformat=json) | ConvertFrom-Json
$json | select -expand Releases | where {[datetime]$_.Assembled -gt ((Get-Date).AddMonths(-1))}

This script will write out a list of releases for the last month:

Version Assembled                     PackageVersions ReleaseNotes
------- ---------                     --------------- ------------
0.0.16  2018-01-04T14:27:25.221+10:00 Deploy1 0.0.1
0.0.15  2018-01-04T14:14:29.369+10:00 Deploy1 0.0.1
0.0.14  2018-01-04T14:06:55.799+10:00 Deploy1 0.0.1
0.0.13  2018-01-04T14:06:44.784+10:00 Deploy1 0.0.1
0.0.12  2018-01-04T13:44:29.273+10:00 Deploy1 0.0.1
0.0.11  2017-12-18T09:36:44.995+10:00 Deploy 0.0.1    
0.0.10  2017-12-18T09:26:22.671+10:00 Deploy 0.0.1    
0.0.9   2017-12-18T09:25:02.342+10:00 Deploy 0.0.1    

Welcome! We use cookies and data about how you use our website allow us to improve the website and your experience, and resolve technical errors. Our website uses cookies and shares some of your data with third party analytics companies for these purposes. We do not use these cookies for advertising.

If you decline, we will respect your privacy. A single cookie will be used in your browser to remember your preference.