Get Previous Deployment Using API

Hello,
I’m trying to obtain the previous deployment to an environment using dynamic dashboard API like this.

$uri = “$OctopusURI/api/dashboard/dynamic?environments=Environments-61&projects=Projects-8&includePrevious=True”
$header = @{“X-Octopus-ApiKey” = $octopusApiKey}
$dash = Invoke-RestMethod -Uri $uri -Headers $Header -Method Get

For some reason $dash.PreviousItems doesn’t’ contain anything. I’ve tried different environment and projects and it’s always null. Does this not work anymore, or am I doing something wrong?

Hi Matthew,

Thanks for getting in touch! Unfortunately this property is always empty and the reasoning behind this decision and possible workaround are described here.

Please let me know if there is anything else I can do to help.

Regards,

Pawel

Thanks for the reply, however the link goes to a deleted or private post

Thanks,
Matt Olson

On May 16, 2017 9:17 PM, Pawel Pabich tender2+d0c13aa350@tenderapp.com wrote:

Hi Matt,

Sorry about that. I didn’t check the status of this conversation but the summary of it is that we don’t populate this property as it is very expensive.

To get previous deployments you would have to use our [deployments API] (https://github.com/OctopusDeploy/OctopusDeploy-Api/wiki/Deployments).

Please let me know you go

Regards,

Pawel