根据documentation,我可以使用以下请求获取特定的变量组
GET .../_apis/distributedtask/variablegroups?groupName={groupName}
这将返回特定变量组的所有变量。
我想要获取特定变量的详细信息,这样我就不必下载所有的变量。e.g
GET .../_apis/distributedtask/variablegroups?groupName={groupName}&VariableName={MyName}
我找过了,但什么也没找到。
发布于 2019-05-30 14:40:33
我不认为只获得一个变量是可能的,所有的想法都是一个组,目前Rest API允许你获得组。
但是,如果您使用PowerShell,则在执行其余操作时,可以轻松地过滤结果:
$url = "https://dev.azure.com/{organization}/{project}/_apis/distributedtask/variablegroups?groupName={name}&api-version=5.0"
$varName = "MyName"
$varValue = (Invoke-RestMethod -Uri $url -Method Get -ContentType application/json).value.variables.$varName
https://stackoverflow.com/questions/56367899
复制相似问题