Azure devops 如何在RESTAPI中按变量名筛选GroupVariables

Azure devops 如何在RESTAPI中按变量名筛选GroupVariables,azure-devops,azure-devops-rest-api,Azure Devops,Azure Devops Rest Api,基于以下请求,我可以获得一个特定的变量组 GET .../_apis/distributedtask/variablegroups?groupName={groupName} 这将返回特定变量组的所有变量 我想获得特定变量的详细信息,这样我就不必下载所有变量。 e、 g 我已经搜索过了,但没有找到任何东西。我认为不可能只得到一个变量,所有的想法都是它是一个组,而目前Rest API允许您获得该组 但如果您使用PowerShell,则在执行其余操作时可以轻松过滤结果: $url = "https

基于以下请求,我可以获得一个特定的变量组

GET .../_apis/distributedtask/variablegroups?groupName={groupName}
这将返回特定变量组的所有变量

我想获得特定变量的详细信息,这样我就不必下载所有变量。 e、 g


我已经搜索过了,但没有找到任何东西。

我认为不可能只得到一个变量,所有的想法都是它是一个组,而目前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

我也不认为我们可以使用API直接获取变量组的名称或值。我们必须手动使用脚本来解析JSON文件以获取名称或值。
$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