Is it possible to add a comment to a work item in Visual Studio Team Services using the REST API?
I've checked the work item doc and fields doc but I couldn't see anything in the fields JSON which looked like it's the comments field.
The scenario I'm trying to achieve is CCing an email to Zapier and having the body of the email added as a comment on the work item in VSO.
Following @tzachs tip, this is the API call to add a comment (or history entry in VSO jargon):
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, or else the last one "wins".
The field you're looking for is 'History', see example here: http://www.visualstudio.com/integrate/reference/reference-vso-work-item-work-items-vsi#updateafield
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With