【发布时间】:2019-01-15 18:33:49
【问题描述】:
我的问题与超过 1 年的 Get latest Associated Work Items for Git Commit using TFS REST API 有关。
我也想获取与 Git 提交相关的所有工作项。找不到相应的 API。但是1年是很长的时间,也许现在已经存在了?
【问题讨论】:
标签: git azure-devops azure-devops-rest-api
我的问题与超过 1 年的 Get latest Associated Work Items for Git Commit using TFS REST API 有关。
我也想获取与 Git 提交相关的所有工作项。找不到相应的 API。但是1年是很长的时间,也许现在已经存在了?
【问题讨论】:
标签: git azure-devops azure-devops-rest-api
您可以使用带有可选参数searchCriteria.includeWorkItems=true 的Get Commits API,您将获得所有提交及其相关工作项。
例如:
https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repoId}/commits?searchCriteria.includeWorkItems=true&?api-version=5.0-preview.1
结果(您将获得所有提交,您可以使用 PowerShell 过滤结果):
"commitId": "60a69554c80839d631e77ea0exxxxxxxxxxx",
"author": {
"name": "Shayki Abramczyk",
"email": "email@gmail.com",
"date": "2018-10-11T14:27:55Z"
},
"committer": {
"name": "Shayki Abramczyk",
"email": "email@gmail.com",
"date": "2018-10-11T14:27:55Z"
},
"comment": "Updated README.md",
"changeCounts": {
"Add": 0,
"Edit": 1,
"Delete": 0
},
"url": "https://dev.azure.com/shaykia/7fcdafd5-b891-4fe5-b2fe-xxxxxxxxxx/_apis/git/repositories/815cc0c7-5f3e-404b-8fd7-xxxxxx/commits/60a69554c80839d631e77eaxxxxxxxx",
"remoteUrl": "https://dev.azure.com/shaykia/xxxxxxx/_git/GitSample/commit/60a69554c80839d631e77ea0ed8bxxxxxxxx",
"workItems": [
{
"id": "18",
"url": "https://dev.azure.com/shaykia/_apis/wit/workItems/18"
}
]
},
很遗憾,Get (one) Commit API 中不存在此选项。
【讨论】:
searchCriteria.ids等于一个提交ID。