Get deployment artifact via API

I have an Octopus step where I am creating the artifact using the Octopus cmdlet New-OctopusArtifact

After artifact creation I want to send Slack message with hyperlink to the artifact, where url is:

I am trying to get the artifact details by calling the API:
$artifact = Invoke-WebRequest -Uri '/api/artifacts?regarding=#{Octopus.Task.Id}' -Headers $authHeader -UseBasicParsing | ConvertFrom-Json
but it is not returning the artifact details, as if it hasn’t been created yet. I also introduced a delay with Start-Sleep before the call but made no difference.

Using the same code to retrieve the artifact details after the deployment completes works as expected and returns the artifact details!

My question is when is the artifact available via the API?

I am about to try again calling the API from a subsequent page…


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