Get tenant variable from deployment from API

operations

(jasper) #1

Since tenant variables are not a part of a release package, is it somehow possible to query a tenant variable from a deployment and get the value?


(Daniel Fischer) #3

Hi,

I’m sorry for the delay in getting back to you here. I’m not too sure if you still need help with this, but I have some info here to help anyone else who may be looking for an answer to this.

To answer your question, yes, you can do this. The following API page will return all the variables for a deployment, including Tenanted variables.

http://OctopusServer/api/variables/variableset-Deployments-83

You can find the Deployment ID (Deployments-83 as example) in the URL of the web portal when viewing a specific deployment.

You can find any Tenanted variables associated with this deployment from this page:

(Text example)

{
      "Id": "02b99b6c-15fa-42d4-a3e3-365335274dc5",
      "Name": "VariableTemplate-A",
      "Value": "apples",
      "Description": null,
      "Scope": {
        "Tenant": [
          "Tenants-1"
        ],
        "Project": [
          "Projects-2"
        ],
        "Environment": [
          "Environments-1"
        ],
        "User": [
          "True"
        ]
      },
      "IsEditable": false,
      "Prompt": null,
      "Type": "String",
      "IsSensitive": false

Any Tenanted variables will be scoped to a Tenant as above.

Again, sorry for such a long delay in getting back to you here. Please feel free to pass through any questions you may have.

Best regards,
Daniel


(jasper) #4

Hi Daniel,

No worries . Thanks for the input - greatly appreciated.