Work Items - Create
Creates a single work item.
POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=4.1
POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?validateOnly={validateOnly}&bypassRules={bypassRules}&suppressNotifications={suppressNotifications}&api-version=4.1
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
organization
|
path | True |
string |
The name of the Azure DevOps organization. |
project
|
path | True |
string |
Project ID or project name |
type
|
path | True |
string |
The work item type of the work item to create |
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. |
bypass
|
query |
boolean |
Do not enforce the work item type rules on this update |
|
suppress
|
query |
boolean |
Do not fire any notifications for this change |
|
validate
|
query |
boolean |
Indicate if you only want to validate the changes without saving the work item |
Request Body
Media Types: "application/json-patch+json"
Name | Type | Description |
---|---|---|
from |
string |
The path to copy from for the Move/Copy operation. |
op |
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 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_write | Grants the ability to read, create, and update work items and queries, update board metadata, read area and iterations paths other work item tracking related metadata, execute queries, and to receive notifications about work item events via service hooks. |
Examples
Create work item
Sample request
POST https://dev.azure.com/fabrikam/{project}/_apis/wit/workitems/${type}?api-version=4.1
[
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "Sample task"
}
]
Sample response
{
"id": 131489,
"rev": 1,
"fields": {
"System.AreaPath": "CustomProcessPrj",
"System.TeamProject": "CustomProcessPrj",
"System.IterationPath": "CustomProcessPrj",
"System.WorkItemType": "Task",
"System.State": "New",
"System.Reason": "New",
"System.CreatedDate": "2017-10-06T01:04:51.57Z",
"System.CreatedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
"System.ChangedDate": "2017-10-06T01:04:51.57Z",
"System.ChangedBy": "Jamal Hartnett <fabrikamfiber4@hotmail.com>",
"System.Title": "Sample task",
"Microsoft.VSTS.Common.StateChangeDate": "2017-10-06T01:04:51.57Z",
"Microsoft.VSTS.Common.Priority": 2
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/131489"
},
"workItemUpdates": {
"href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/131489/updates"
},
"workItemRevisions": {
"href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/131489/revisions"
},
"workItemHistory": {
"href": "https://dev.azure.com/fabrikam/_apis/wit/workItems/131489/history"
},
"html": {
"href": "https://dev.azure.com/fabrikam/web/wi.aspx?pcguid=20cda608-32f0-4e6e-9b7c-8def7b38d15a&id=131489"
},
"workItemType": {
"href": "https://dev.azure.com/fabrikam/aaee31d9-14cf-48b9-a92b-3f1446c13f80/_apis/wit/workItemTypes/Task"
},
"fields": {
"href": "https://dev.azure.com/fabrikam/_apis/wit/fields"
}
},
"url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/131489"
}
Definitions
Name | Description |
---|---|
Json |
The JSON model for JSON Patch Operations |
Operation |
The patch operation |
Reference |
The class to represent a collection of REST reference links. |
Work |
Describes a work item. |
Work |
JsonPatchDocument
The JSON model for JSON Patch Operations
Name | Type | Description |
---|---|---|
from |
string |
The path to copy from for the Move/Copy operation. |
op |
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 | Description |
---|---|---|
add |
string |
|
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 |
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 |
WorkItemRelation
Name | Type | Description |
---|---|---|
attributes |
object |
Collection of link attributes. |
rel |
string |
Relation type. |
url |
string |
Link url. |