我从邮差试图用HTTP-POST打开使用JSON新的用户故事。在报头是内容类型:应用/ JSON-补丁+ JSON
文件看起来像:
{
"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"
}
}
错误:
{
"$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
}
如果你想创建一个工作项(Rest Api Work Items - Create)使用以下链接和身体:
POST
HTTP(S)://您的服务器:端口/ TFS / DefaultCollection / EJ2TFS / _apis /机智/工作项/ $用户故事API版本= 4.0
身体
[
{
"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"
}
]