Work Items - Get Work Item Template

从模板返回单个工作项。

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=6.1-preview.3
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?fields={fields}&asOf={asOf}&$expand={$expand}&api-version=6.1-preview.3

URI 参数

名称 必需 类型 说明
organization
path True

string

Azure DevOps 组织的名称。

project
path True

string

项目 ID 或项目名称

type
path True

string

工作项类型名称

api-version
query True

string

要使用的 API 版本。 应将其设置为“6.1-preview.3”才能使用此版本的 API。

$expand
query

WorkItemExpand

工作项属性的展开参数。 可能的选项包括 {None、Relations、Fields、Links、All }。

asOf
query

string

date-time

AsOf UTC 日期时间字符串

fields
query

string

以逗号分隔的请求字段列表

响应

名称 类型 说明
200 OK

WorkItem

成功的操作

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名称 说明
vso.work 授予读取工作项、查询、板、区域和迭代路径以及其他工作项跟踪相关元数据的能力。 此外,还允许通过服务挂钩执行查询、搜索工作项和接收有关工作项事件的通知。

示例

Returns a single work item from a template

Sample Request

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=6.1-preview.3

Sample Response

{
  "fields": {
    "System.WorkItemType": "Bug",
    "System.AreaPath": "Test Project",
    "System.TeamProject": "Test Project",
    "System.IterationPath": "Test Project",
    "System.State": "New",
    "System.Reason": "New",
    "Microsoft.VSTS.Common.StateChangeDate": "1753-01-01T00:00:00Z",
    "System.ChangedBy": {
      "displayName": "Fabricam Zhang",
      "url": "https://app.vssps.visualstudio.com/Accf03646-3dbb-4c84-91f3-739a6c8797a1/_apis/Identities/5f499b36-f993-6330-9295-1abf1a669337",
      "_links": {
        "avatar": {
          "href": "https://dev.azure.com/fabricam3/_apis/GraphProfile/MemberAvatars/msa.NWY0OTliMzYtZjk5My03MzMwLTkyOTUtMWFiZjFhNjY5MzM3"
        }
      },
      "id": "5f499b36-f993-6330-9295-1abf1a669337",
      "uniqueName": "fabricam2@outlook.com",
      "imageUrl": "https://dev.azure.com/fabricam3/_api/_common/identityImage?id=5f499b36-f993-6330-9295-1abf1a669337",
      "descriptor": "msa.NWY0OTliMzYtZjk5My03MzMwLTkyOTUtMWFiZjFhNjY5MzM3"
    },
    "System.CreatedBy": {
      "displayName": "Fabricam Zhang",
      "url": "https://app.vssps.visualstudio.com/Accf03646-3dbb-4c84-91f3-739a6c8797a1/_apis/Identities/5f499b36-f993-6330-9295-1abf1a669337",
      "_links": {
        "avatar": {
          "href": "https://dev.azure.com/fabricam3/_apis/GraphProfile/MemberAvatars/msa.NWY0OTliMzYtZjk5My03MzMwLTkyOTUtMWFiZjFhNjY5MzM3"
        }
      },
      "id": "5f499b36-f993-6330-9295-1abf1a669337",
      "uniqueName": "fabricam2@outlook.com",
      "imageUrl": "https://dev.azure.com/fabricam3/_api/_common/identityImage?id=5f499b36-f993-6330-9295-1abf1a669337",
      "descriptor": "msa.NWY0OTliMzYtZjk5My03MzMwLTkyOTUtMWFiZjFhNjY5MzM3"
    },
    "Microsoft.VSTS.Common.Priority": 2,
    "Microsoft.VSTS.Common.Severity": "3 - Medium",
    "Microsoft.VSTS.Common.ValueArea": "Business"
  },
  "_links": {
    "workItemType": {
      "href": "https://dev.azure.com/fabricam3/c1b5ee8b-7c3f-4e7d-bb53-ce022cf5af4b/_apis/wit/workItemTypes/Bug"
    },
    "fields": {
      "href": "https://dev.azure.com/fabricam3/c1b5ee8b-7c3f-4e7d-bb53-ce022cf5af4b/_apis/wit/fields"
    }
  },
  "url": "https://dev.azure.com/fabricam3/c1b5ee8b-7c3f-4e7d-bb53-ce022cf5af4b/_apis/wit/workItems"
}

定义

名称 说明
ReferenceLinks

表示 REST 引用链接集合的类。

WorkItem

描述工作项。

WorkItemCommentVersionRef

表示对工作项注释的特定版本的引用。

WorkItemExpand

工作项属性的展开参数。 可能的选项包括 { None, Relations, Fields, Links, All }

WorkItemRelation

表示 REST 引用链接集合的类。

名称 类型 说明
links

object

链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读。

WorkItem

描述工作项。

名称 类型 说明
_links

ReferenceLinks

将引用链接到相关的 REST 资源。

commentVersionRef

WorkItemCommentVersionRef

引用此修订版中添加/编辑/删除的特定版本的注释。

fields

object

工作项的字段和值的映射。

id

integer

工作项 ID。

relations

WorkItemRelation[]

工作项的关系。

rev

integer

工作项的修订号。

url

string

WorkItemCommentVersionRef

表示对工作项注释的特定版本的引用。

名称 类型 说明
commentId

integer

分配给注释的 ID。

createdInRevision

integer

[内部]最初添加此注释的工作项修订。

isDeleted

boolean

[内部]指定是否删除注释。

text

string

[内部]批注的文本。

url

string

version

integer

版本号。

WorkItemExpand

工作项属性的展开参数。 可能的选项包括 { None, Relations, Fields, Links, All }

名称 类型 说明
all

string

展开全部。

fields

string

字段工作项展开。

links

string

链接工作项展开。

none

string

默认行为。

relations

string

关系工作项展开。

WorkItemRelation

名称 类型 说明
attributes

object

链接属性的集合。

rel

string

关系类型。

url

string

链接 URL。