Partager via


Work item tracking

TFS 2017 | TFS 2015 | TFS 2013

Note

Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.

api-version = 1.0

Work item tracking resources

Get, create, and update bugs, tasks, and other work items for your team. Queries allow you to use the full power of the work item query language to search for and filter work items. You can use the work item query language to get to each work item that satisfies the query. Work items retain a full history, and you can get each full revision of the work item, or just the updates that were made in each revision. Work items can also be tagged.

Work item metadata resources

Work items are governed by metadata. Some of the metadata is scoped to a specific project, and other metadata is scoped to a project collection (like your VSTS organization's default collection).

Project-scoped metadata

Your project has a set of work item types. Each work item type may belong to a category such as "requirement" or "bug" to define its role in the project. Classification nodes define the set of values that can be used in the area and iteration fields for the work items in the project.

Collection-scoped metadata

Work item types share fields and relation types (links and attachments) with other types of work items.

Common tasks

Get work items using a query

  1. Look up the query that you want to use.
  2. Get the results for that query.
  3. Get each of the work items by ID.

Update a work item's fields

  1. Get the ID of the work item that you want to update.
  2. Update the fields of the work item.

Update multiple work items' fields

  1. Get the IDs of the work items that you want to update.
  2. Update the fields using a batch call of the work items.
  1. Get the ID of the work items that you want to link.
  2. Add a link between the work items.

Use the create a work item and add a link APIs in a batch call.

Attach a file to a work item

  1. Get the ID of the work item that you want to update.
  2. Upload the attachment to the attachment store.
  3. Add the attachment to the work item.

Create a work item

Create a work item. Make sure you provide at least a title. Some types of work items will require values for other fields.

Get a work item's discussion history

  1. Get the ID of the work item.
  2. Get the work item's discussion history.

Get a work item's full history

  1. Get the ID of the work item.
  2. Get a list of updates made to a work item.
  3. Get the whole work item as it appeared in any revision.

Delete a work item

  1. Get the ID of the work item.
  2. Delete the work item.

Restore a work item

  1. Get the list of items in the recycle bin.
  2. Restore a work item.

Tag a work item

  1. Get the ID of the work item that you want to update.
  2. Get the ID of the tag that you want to add. If it doesn't exist, create it.
  3. Add the tag to the work item by updating the tags field.

Get the fields used in a project

  1. Get the types of work items used in a project.
  2. Get each work item type to see the fields that it uses. (Skip past the xmlForm to fieldInstances.)

Get categories of work items

Use categories of work items to get the types of work items used in a project for different functions. For example, to see the work items that appear on the backlog, get the requirements category.

Get areas and iterations

Get the area hierarchy or iteration hierarchy for your project.

Get types of work item relations

Get the available types of work item links that are available in your project collection.