Azure DevOps REST Api 标记调用(回购 > 标记)
Azure DevOps REST Api Tags call (Repos > Tags)
是否有 Repos Tags
REST Api 调用来从此页面获取数据? (回购 > 标签)
如果它还包含 CREATE
、PATCH
和 DELETE
就太棒了。
它自己使用的选项卡https://dev.azure.com/{organization}/_git/{repo}/tags?__rt=fps&__ver=2
我认为这是一个坏兆头。
编辑 1:创建标签
创建:Create Tag
按钮使用:Annotated Tags
因此,此 REST Api 调用中缺少的是 LIST
以获取元素的 {objectId}
。
编辑 2:列出和删除标签
List:要列出所有标签 objectId
,我发现您可以使用 Refs - List
Delete:我认为这个调用完全没有记录。但是你可以理解 TFS 使用以下有效负载来完成这项工作:
var json = {
name: `refs/tags/${xName}`,
newObjectId: '0000000000000000000000000000000000000000',
oldObjectId: xObjectId
};
var payload = [json];
Post 这个 payload
到 https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?api-version=5.1
编辑 3:git 客户端的行为
我发现在客户端更新 git tags
的唯一方法是 here:
git tag -l | xargs git tag -d
git fetch --tags
1.创建标签: Create/Get tag apis
创建标签:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags?api-version=6.0-preview.1
获取标签:
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags/{objectId}?api-version=6.0-preview.1
2.列出标签: 我们没有“带注释的 Tags-List”,但我们有 Refs-tags 做类似的工作。 (来自 Mar Tin 的提示,感谢他!)
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?filter=tags/&api-version=6.0-preview.1
3.删除标签(F12取):
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{RepoName}/refs?api-version=5.1
Request Body(不要忘记[
和]
,在PostMan中测试时需要):
[{
"name": "refs/tags/{TagName}",
"newObjectId": "0000000000000000000000000000000000000000",
"oldObjectId": "{OldObjectID}"
}]
注意:所有关于ObjectID
的信息都可以通过tip2中的Refs-tags
api获取。
For your question about whether the tag is really deleted or is it
only moved to a sneaky archive.
当您尝试通过 Web 门户中的“删除标签”按钮删除标签时,您会看到:
而我从 Edge(F12) 获取的对应请求是:
因此该标签将永久删除,而不仅仅是移动到偷偷摸摸的存档中。
是否有 Repos Tags
REST Api 调用来从此页面获取数据? (回购 > 标签)
如果它还包含 CREATE
、PATCH
和 DELETE
就太棒了。
它自己使用的选项卡https://dev.azure.com/{organization}/_git/{repo}/tags?__rt=fps&__ver=2 我认为这是一个坏兆头。
编辑 1:创建标签
创建:Create Tag
按钮使用:Annotated Tags
因此,此 REST Api 调用中缺少的是 LIST
以获取元素的 {objectId}
。
编辑 2:列出和删除标签
List:要列出所有标签 objectId
,我发现您可以使用 Refs - List
Delete:我认为这个调用完全没有记录。但是你可以理解 TFS 使用以下有效负载来完成这项工作:
var json = {
name: `refs/tags/${xName}`,
newObjectId: '0000000000000000000000000000000000000000',
oldObjectId: xObjectId
};
var payload = [json];
Post 这个 payload
到 https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?api-version=5.1
编辑 3:git 客户端的行为
我发现在客户端更新 git tags
的唯一方法是 here:
git tag -l | xargs git tag -d
git fetch --tags
1.创建标签: Create/Get tag apis
创建标签:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags?api-version=6.0-preview.1
获取标签:
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/annotatedtags/{objectId}?api-version=6.0-preview.1
2.列出标签: 我们没有“带注释的 Tags-List”,但我们有 Refs-tags 做类似的工作。 (来自 Mar Tin 的提示,感谢他!)
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/refs?filter=tags/&api-version=6.0-preview.1
3.删除标签(F12取):
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{RepoName}/refs?api-version=5.1
Request Body(不要忘记[
和]
,在PostMan中测试时需要):
[{
"name": "refs/tags/{TagName}",
"newObjectId": "0000000000000000000000000000000000000000",
"oldObjectId": "{OldObjectID}"
}]
注意:所有关于ObjectID
的信息都可以通过tip2中的Refs-tags
api获取。
For your question about whether the tag is really deleted or is it only moved to a sneaky archive.
当您尝试通过 Web 门户中的“删除标签”按钮删除标签时,您会看到:
而我从 Edge(F12) 获取的对应请求是:
因此该标签将永久删除,而不仅仅是移动到偷偷摸摸的存档中。