如何在 VSTS API 中删除带注释的标签(git 标签)?
How to delete an annotated tag (git tag) in VSTS API?
我能够使用下面的请求成功创建带注释的标签(git 标签),但我无法以编程方式删除它。
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags?api-version=4.1-preview.1
要求:
{
"name": "wagner-test-3",
"message": "wagner-test-3",
"taggedObject": {
"objectId": "aaaaab6cad84a07b7bd65cf3519142a12f856baa"
}
}
根据 documentation there is no delete endpoint, so I've tried the delete ref endpoint 但到目前为止运气不好。它只有 returns 400(无效请求)。
DELETE https://dev.azure.com/{organization}/{project}/_apis/git/favorites/refs/{favoriteId}?api-version=4.1-preview.1
回复:
{
"count": 1,
"value": {
"Message": "The request is invalid."
}
}
谢谢。
我能够弄清楚我自己的问题。删除注释标签的方法是用 Refs API 更新它。虽然这没有很好的记录。
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?api-version=4.1
要求:
[
{
"name": "refs/tags/wagner-test-3",
"newObjectId": "0000000000000000000000000000000000000000",
"oldObjectId": "aaaaab6cad84a07b7bd65cf3519142a12f856baa"
}
]
Azure DevOps 文档:
Refs - Update Refs
创建、更新或删除 引用(分支)。
我能够使用下面的请求成功创建带注释的标签(git 标签),但我无法以编程方式删除它。
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags?api-version=4.1-preview.1
要求:
{
"name": "wagner-test-3",
"message": "wagner-test-3",
"taggedObject": {
"objectId": "aaaaab6cad84a07b7bd65cf3519142a12f856baa"
}
}
根据 documentation there is no delete endpoint, so I've tried the delete ref endpoint 但到目前为止运气不好。它只有 returns 400(无效请求)。
DELETE https://dev.azure.com/{organization}/{project}/_apis/git/favorites/refs/{favoriteId}?api-version=4.1-preview.1
回复:
{
"count": 1,
"value": {
"Message": "The request is invalid."
}
}
谢谢。
我能够弄清楚我自己的问题。删除注释标签的方法是用 Refs API 更新它。虽然这没有很好的记录。
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?api-version=4.1
要求:
[
{
"name": "refs/tags/wagner-test-3",
"newObjectId": "0000000000000000000000000000000000000000",
"oldObjectId": "aaaaab6cad84a07b7bd65cf3519142a12f856baa"
}
]
Azure DevOps 文档: Refs - Update Refs 创建、更新或删除 引用(分支)。