如何使用REST API获取TFS(Team Foundation Server)工作项(错误,任务)详细信息? [英] How to get TFS(Team Foundation Server) work items(bug,task) details using REST api?
问题描述
我一直在研究TFS REST api,以获取工作项(错误,任务)的详细信息.我用过GET方法,
I have been working on TFS REST api, to get the work items(bug,task) details. I have used GET method,
GET https://shankarsam.visualstudio.com/DefaultCollection/New-1/_apis/wit/queries/Shared%20Queries/My%20Bugs?$depth=1&api-version=2.2
它显示以下输出
"id": "e7731d7b-10d2-441f-899f-b081e4008b21",
"name": "My Bugs",
"path": "Shared Queries/My Bugs",
"createdBy":
{
"id": "7bb24a89-a490-4ffa-9047-252e4a2b274b",
"displayName": "kalaisankaran B "
},
"createdDate": "2016-07-15T05:30:18.34Z",
"lastModifiedBy":
{
"id": "7bb24a89-a490-4ffa-9047-252e4a2b274b",
"displayName": "kalaisankaran B "
},
"lastModifiedDate": "2016-07-15T05:30:18.34Z",
"isPublic": true,
我无法获得所有错误的详细信息.在使用UI的情况下,我已导航至共享查询"->我的错误"->错误"已列出.请查看所附的屏幕截图.
I couldn't get all bug details. In case of UI, I have navigated to Shared Queries -> My Bugs -> Bugs has been listed. Please see the attached screen shot.
推荐答案
我找到了解决方案.如果我们需要显示项目中关联的所有Bug或任务.使用以下rest api调用.
I got the solution. If we need to display all the Bugs or Tasks which is associated in the project. Use the following rest api call.
POST https://<Account Name>.visualstudio.com/DefaultCollection/<Project Name>/_apis/wit/wiql?api-version=1.0
Ex :
POST https://shankarsam.visualstudio.com/DefaultCollection/New-1/_apis/wit/wiql?api-version=1.0
标题:
Content-Type application/json
请求正文Ex:
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Bug'"
}
需要显示Task项目的意思,请尝试以下 [System.WorkItemType] ='Task'
Need to display Task item means , try this [System.WorkItemType] = 'Task'
显示与Bug或任务相关的工作项,回购尝试一下:
Display Bug or Task related work items, Repo's try this :
GET https://<Account Name>.visualstudio.com/DefaultCollection/_apis/wit/workitems?id=<Issue ID>&$expand=all&api-version=1.0
Ex:
GET https://shankarsam.visualstudio.com/DefaultCollection/_apis/wit/workitems?id=23&$expand=all&api-version=1.0
这篇关于如何使用REST API获取TFS(Team Foundation Server)工作项(错误,任务)详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!