0
votes

devops REST API provides a very handy asOf paramater for workitems in order to get a past snapshot of their state.

https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-5.1#uri-parameters

we would like to include the comments at that snapshot/asOf moment, however we aren't able to use $expand (tested with 'All')

enter image description here

our fallback is then to use the comments endpoint : https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/comments/get%20comments?view=azure-devops-rest-5.1

but this one lacks asOf parameter, I tried with just to be sure it's not hidden/undocumented, but with no luck.

GET https://dev.azure.com/xxxx/xxxx/_apis/wit/workitems/16247/comments?api-version=5.1-preview.3&asOf=2020-06-01T07:00:56.89Z

any idea/workaround how to address this ? we can play with comment createdDate & changedDate to find similar behavior, and/or fetching all comment revisions. however I wanted to know if I didn't missed an obvious approach.

1

1 Answers

0
votes

You can get the comment in System.History field using the Work Items - List Api, but in this api, it only returns the latest revision of the work items you list:

enter image description here

To list all comments, you need to use Comments - Get Comments api, but asOf parameter doesn't work in this api. So the workaround is using createdDate & changedDate to find the items you need.