Work Item Batch Update
Service : Work Item Tracking
API Version : 5.0
Performs multiple Work Item Update requests. Response contains individual responses for each of the requests in the batch. Failed requests do not affect subsequent requests in the batch.
PATCH : https://{accountName}.visualstudio.com/_apis/wit/$batch?api-version=5.0
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
accountName | Path | True | string | The name of the Azure DevOps Services account. |
api-version | query | string | Version of the API to use. This should be set to '4.1' to use this version of the api. | |
bypassRules | query | boolean | Do not enforce the work item type rules on this update. |
Request Body
Media Type : "application/json-patch+json"
Name | Required | Type | Description |
---|---|---|---|
from | string | The path to copy from for the Move/Copy operation. | |
op | Operation | The patch operation | |
path | string | The path for the operation | |
value | object | The value for the operation. This is either a primitive or a JToken. |
Responses
Name | Type | Description |
---|---|---|
200 | WorkItem | successful operation |
Example
Request
PATCH https://dev.azure.com/fabrikam/_apis/wit/$batch?api-version=5.0
Request Body
[
{
// Add priority and test rev on work item with id 1
"method": "PATCH",
"uri": "/_apis/wit/workitems/1?api-version=5.0",
"headers": {
"Content-Type": "application/json-patch+json"
},
"body": [
{
"op": "test",
"path": "/rev",
"value": 3
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.Common.Priority",
"value": "1"
}
]
},
{
// Replace tags on work item with id 299x
"method": "PATCH",
"uri": "/_apis/wit/workitems/299?api-version=5.0",
"headers": {
"Content-Type": "application/json-patch+json"
},
"body": [
{
"op": "replace",
"path": "/fields/System.Tags",
"value": "Tag1; Tag2"
}
]
},
{
// You can also use Work Item Create format
"method": "PATCH",
"uri": "/mytestprojectname/_apis/wit/workitems/$Bug?api-version=5.0",
"headers": {
"Content-Type": "application/json-patch+json"
},
"body": [
{
"op": "add",
"path": "/id",
"value": "-1"
},
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "Sample 1"
}
]
},
]
Response
Response consist of individual responses for each batched update request.
- count : number of batched update responses returned
- value : list of response objects with its response code, headers and body
{
"count": 2,
"value": [
{
"code": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": "{work item object}"
},
{
"code": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": "{work item object}"
}
]
}
Definitions
JsonPatchDocument | The JSON model for JSON Patch Operations |
---|---|
Operation | The patch operation |
ReferenceLinks | The class to represent a collection of REST reference links. |
WorkItem | Describes a work item. |
WorkItemRelation | Relation to the work item |
JsonPatchDocument
The JSON model for JSON Patch Operations
Name | Type | Description |
---|---|---|
from | string | The path to copy from for the Move/Copy operation. |
op | [Operation] | The patch operation |
path | string | The path for the operation |
value | object | The value for the operation. This is either a primitive or a JToken. |
Operation
The patch operation
Name | Type |
---|---|
copy | string |
move | string |
remove | string |
replace | string |
test | string |
ReferenceLinks
The class to represent a collection of REST reference links.
Name | Type | Description |
---|---|---|
links | <string, 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 | [ReferenceLinks] | Link references to related REST resources. |
fields | <string, object> | Map of field and values for the work item. |
id | integer | The work item ID. |
relations | WorkItemRelation | Relations of the work item. |
rev | integer | Revision number of the work item. |
url | string |
WorkItemRelation
Name | Type | Description |
---|---|---|
attributes | <string, object> | Collection of link attributes. |
rel | string | Relation type. |
url | string | Link url. |
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for