Work Items - Get Work Item

Returns a single work item.

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

URI Parameters

Name In Required Type Description
id
path True
  • integer
int32

The work item id

organization
path True
  • string

The name of the Azure DevOps organization.

project
path
  • string

Project ID or project name

api-version
query True
  • string

Version of the API to use. This should be set to '4.1' to use this version of the api.

$expand
query

The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.

asOf
query
  • string
date-time

AsOf UTC date time string

fields
query
  • string
array (string)

Comma-separated list of requested fields

Responses

Name Type Description
200 OK

successful operation

Security

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

Name Description
vso.work Grants the ability to read work items, queries, boards, area and iterations paths, and other work item tracking related metadata. Also grants the ability to execute queries and to receive notifications about work item events via service hooks.

Examples

Get work item
Get work item with asOf parameter

Get work item

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/workitems/12?api-version=4.1

Sample Response

{
  "id": 12,
  "rev": 3,
  "fields": {
    "System.AreaPath": "MyAgilePrj2",
    "System.TeamProject": "MyAgilePrj2",
    "System.IterationPath": "MyAgilePrj2\\Iteration 1",
    "System.WorkItemType": "User Story",
    "System.State": "Active",
    "System.Reason": "Implementation started",
    "System.AssignedTo": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.CreatedDate": "2017-09-04T06:11:59.05Z",
    "System.CreatedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.ChangedDate": "2017-10-04T23:32:02.18Z",
    "System.ChangedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.Title": "Epic 2",
    "Microsoft.VSTS.Common.StateChangeDate": "2017-10-04T23:32:01.6Z",
    "Microsoft.VSTS.Common.ActivatedDate": "2017-10-04T23:32:01.6Z",
    "Microsoft.VSTS.Common.ActivatedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "Microsoft.VSTS.Common.Priority": 2,
    "Microsoft.VSTS.Common.ValueArea": "Business",
    "System.Tags": "client; sample; teamservices"
  },
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/12"
    },
    "workItemUpdates": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/12/updates"
    },
    "workItemRevisions": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/12/revisions"
    },
    "workItemHistory": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/12/history"
    },
    "html": {
      "href": "https://dev.azure.com/fabrikam/web/wi.aspx?pcguid=20cda608-32f0-4e6e-9b7c-8def7b38d15a&id=12"
    },
    "workItemType": {
      "href": "https://dev.azure.com/fabrikam/54332e84-3d54-4c67-9bd0-0e88a9849330/_apis/wit/workItemTypes/User%20Story"
    },
    "fields": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/fields"
    }
  },
  "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/12"
}

Get work item with asOf parameter

Sample Request

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/workitems/564?asOf=2017-12-21T19:42:54.230Z&api-version=4.1

Sample Response

{
  "id": 564,
  "rev": 4,
  "fields": {
    "System.AreaPath": "MyAgilePrj2",
    "System.TeamProject": "MyAgilePrj2",
    "System.IterationPath": "MyAgilePrj2\\Iteration 0",
    "System.WorkItemType": "Task",
    "System.State": "Proposed",
    "System.Reason": "New",
    "System.AssignedTo": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.CreatedDate": "2017-12-16T00:46:58.01Z",
    "System.CreatedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.ChangedDate": "2017-12-16T00:49:08.81Z",
    "System.ChangedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
    "System.Title": "t1.3",
    "Microsoft.VSTS.Common.StateChangeDate": "2017-12-16T00:46:58.01Z",
    "Microsoft.VSTS.Common.Priority": 2,
    "Microsoft.VSTS.CMMI.Blocked": "No",
    "Microsoft.VSTS.Common.Triage": "Pending",
    "Microsoft.VSTS.CMMI.TaskType": "Planned",
    "Microsoft.VSTS.CMMI.RequiresReview": "No",
    "Microsoft.VSTS.CMMI.RequiresTest": "No"
  },
  "_links": {
    "self": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/564/revisions/4"
    },
    "workItemRevisions": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/564/revisions"
    },
    "parent": {
      "href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/564"
    }
  },
  "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/564/revisions/4"
}

Definitions

ReferenceLinks

The class to represent a collection of REST reference links.

WorkItem

Describes a work item.

WorkItemExpand

The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.

WorkItemRelation

The class to represent a collection of REST reference links.

Name Type Description
links
  • object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

WorkItem

Describes a work item.

Name Type Description
_links

Link references to related REST resources.

fields
  • object

Map of field and values for the work item.

id
  • integer

The work item ID.

relations

Relations of the work item.

rev
  • integer

Revision number of the work item.

url
  • string

WorkItemExpand

The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.

Name Type Description
all
  • string
fields
  • string
links
  • string
none
  • string
relations
  • string

WorkItemRelation

Name Type Description
attributes
  • object

Collection of link attributes.

rel
  • string

Relation type.

url
  • string

Link url.