How to add a comment to a work item using the Visual Studio Team Services REST API

Can I add a comment to a work item in Visual Studio Team Services using the REST API?

I checked the doc work item and doc fields , but I didn't see anything in the JSON fields that looked like comment fields.

The scenario I'm trying to achieve is CCing an email to Zapier and with the text of the email added as a comment on a work item in VSO.

+3


source to share


2 answers


Following @tzachs hint, this is an API call to add a comment (or write history in VSO lingo):

PATCH https://{account}.visualstudio.com/defaultcollection/_apis/wit/workitems/{id}?api-version=1.0-preview.2

      

JSON payload:



[  
  {
    "op": "add",
    "path": "/fields/System.History",
    "value": "Comment from VSO REST API"
  }
]

      

Note . If you want to add multiple comments, you need to issue separate patch requests, otherwise the latter will "win."

+6


source


The field you are looking for is History, see an example here: http://www.visualstudio.com/integrate/reference/reference-vso-work-item-work-items-vsi#updateafield



+1


source







All Articles