我的团队正在使用Team Foundation Server 2017跟踪UserStories,我们也将存储库存储在同一项目的TFS Git中。我想使用TFS的rest api帮助我们的团队记录每个Sprint中的更改。
使用commitID,我是否可以找到与该提交有关联的所有Userstory?我确实看到Userstories具有指向与之关联的提交的链接,但是我能够查看与commitID相关的所有故事吗?
谢谢
答案 0 :(得分:0)
如果要查询GIT提交,以获取与特定提交相关的相关工作项ID。
您可以使用以下Rest API 和可选参数来询问每次提交的详细信息:
GET https://{accountName}.visualstudio.com/{project}/_apis/git/repositories/{repositoryId}/commits?searchCriteria.historyMode={searchCriteria.historyMode}&searchCriteria.includeWorkItems={searchCriteria.includeWorkItems}&searchCriteria.includeLinks={searchCriteria.includeLinks}&searchCriteria.$top={searchCriteria.$top}&searchCriteria.$skip={searchCriteria.$skip}&searchCriteria.excludeDeletes={searchCriteria.excludeDeletes}&searchCriteria.itemPath={searchCriteria.itemPath}&searchCriteria.author={searchCriteria.author}&searchCriteria.user={searchCriteria.user}&searchCriteria.toCommitId={searchCriteria.toCommitId}&searchCriteria.fromCommitId={searchCriteria.fromCommitId}&searchCriteria.compareVersion.versionOptions={searchCriteria.compareVersion.versionOptions}&searchCriteria.compareVersion.version={searchCriteria.compareVersion.version}&searchCriteria.compareVersion.versionType={searchCriteria.compareVersion.versionType}&searchCriteria.itemVersion.versionOptions={searchCriteria.itemVersion.versionOptions}&searchCriteria.itemVersion.version={searchCriteria.itemVersion.version}&searchCriteria.itemVersion.versionType={searchCriteria.itemVersion.versionType}&searchCriteria.toDate={searchCriteria.toDate}&searchCriteria.fromDate={searchCriteria.fromDate}&searchCriteria.ids={searchCriteria.ids}&$skip={$skip}&$top={$top}&api-version=4.1
用于查询工作项的相关信息应为&searchCriteria.includeWorkItems={searchCriteria.includeWorkItems}
更多详细信息,请参阅官方教程Commits - Get Commits,请注意API版本应符合您的TFS版本。