I am trying from POSTMAN with http-post to open new user story using JSON. In header is Content-Type: application/json-patch+json
File looks like:
{
"id":33560,
"rev":2,
"fields":{
"System.AreaPath":"EJ2TFS",
"System.TeamProject":"EJ2TFS",
"System.IterationPath":"EJ2TFS\\Iteration 1",
"System.WorkItemType":"User Story",
"System.State":"New",
"System.Reason":"New",
"System.AssignedTo":"User, User <firm\\user>",
"System.Title":"Postman_POST",
"Microsoft.VSTS.Common.Priority":2,
"Microsoft.VSTS.Common.ValueArea":"Business",
"System.History":"Comment"
}
}
Error:
{
"$id": "1",
"innerException": null,
"message": "You must pass a valid patch document in the body of the request.",
"typeName": "Microsoft.VisualStudio.Services.Common.VssPropertyValidationException, Microsoft.VisualStudio.Services.Common",
"typeKey": "VssPropertyValidationException",
"errorCode": 0,
"eventId": 3000
}
If you want to create a work item (Rest Api Work Items - Create) use the url and body below:
POST
http(s)://your_server:port/tfs/DefaultCollection/EJ2TFS/_apis/wit/workitems/$user story?api-version=4.0
Body
[
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "Postman_POST"
},
{
"op": "add",
"path": "/fields/System.AssignedTo",
"from": null,
"value": "User, User <firm\\user>"
},
{
"op": "add",
"path": "/fields/System.IterationPath",
"from": null,
"value": "EJ2TFS\\Iteration 1"
}
]