用于更新变量的 VSTS 变量组 API?

VSTS Variable Group API for updating a variable?

是否有 API 调用(可能是 PUT)可用于更新变量组中的变量?

我试过 PUT 到

https://<my>.visualstudio.com/<project>/_apis/distributedtask/variablegroups

与 JSON 喜欢

{"variables": {"somevariable":{"value":"12"}}}

但是我得到一个错误

The requested resource does not support http method 'PUT'.

谢谢

变量组可以通过REST API更新。详情如下:

PUT https://account.visualstudio.com/DefaultCollection/{project}/_apis/distributedtask/variablegroups/{variableGroupId}?api-version=4.1-preview

application/json

{
  "variables": {
    "var1": {
      "value": "new value"
    },
    "var2": {
      "value": "new value"
    }
  },
  "type": "Vsts",
  "name": "variable group name",
  "description": "Updated variable group"
}

经过多次试验和错误后,我在这里找到了一个很好的教程 - 这对我有用:

Updating a VSTS variable group from the command line

谢谢丹尼尔斯托克!