hi, I want to automatically pull specific information about the process + Project Variables in the project at regular intervals through the Octopus API interface : download as json , Can you help me with this?
Good morning @david.sun,
Thank you for contacting Octopus Support, welcome to the forums and great question on grabbing the deployment process JSON.
You may pull this directly from the API using the following URL (be sure to replace the URL, SpaceID, and ProjectID):
So you could pull this from a run a script step if you wanted to in a runbook which you could setup to run at regular intervals as you mentioned.
If you right click on the ‘Download as JSON’ button and select ‘copy link address’ or ‘open in new tab’ you will be able to see the JSON if you paste it into your browser, so you can grab the URL from whatever project you want from the UI for the runbook.
If you wanted it as a json file you could pipe the output of the deployment process to a .json file and attach it to the runbook as an artifact.
The variables you can get from this call:
Hopefully that helps, let me know if you wanted anything further and we will do our best to assist.
How to add authentication information?
Just stepping in for Clare while she’s offline, I’d be happy to help!
Once you have a key, you can provide it to the API in the following ways:
- Through the
X-Octopus-ApiKeyHTTP header with all requests. This is the preferred approach.
- As an
apikeyquery string parameter with all requests. This should only be used for simple requests.
Check out our API examples to see this in action: API examples | Documentation and Support
Hope that helps but feel free to reach out with any questions at all!
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.