缺少 devops REST API 工作项注释的 asOf 参数

missing devops REST API asOf parameter for workitem comments

devops REST API 为工作项提供了一个非常方便的 asOf 参数,以获取其状态的过去快照。

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

我们想在那个 snapshot/asOf 时刻包含评论,但是我们无法使用 $expand(通过 'All' 测试)

我们的后备方案是使用评论端点:https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/comments/get%20comments?view=azure-devops-rest-5.1

但是这个缺少 asOf 参数,我试过只是为了确保它不是 hidden/undocumented,但没有成功。

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

任何 idea/workaround 如何解决这个问题?我们可以玩评论 createdDate 和 changedDate 来找到类似的行为,and/or 获取所有评论修订。但是我想知道我是否没有错过一个明显的方法。

您可以使用工作项列表 Api 在 System.History 字段中获取评论,但在此 api 中,它仅 returns 的最新修订版您列出的工作项目:

要列出所有评论,您需要使用 Comments - Get Comments api,但 asOf 参数在此 api 中不起作用。因此,解决方法是使用 createdDate 和 changedDate 来查找您需要的项目。