Kurkula
Kurkula

Reputation: 6762

Devops work item get top one revision data order by descending

I am trying to get azure devops work its history/revisions using Updates-List or Updates-Get.

How can I get latest revision of a work item? I tried with odata query to order by rev and take top 1 but the result is always top 1 with out applying filter.

My Query: myrepo/_apis/wit/workItems/30/updates?$orderby=rev desc&$top=1&api-version=6.0

Similar stackoverflow reference is here

Upvotes: 0

Views: 409

Answers (1)

Expiscornovus
Expiscornovus

Reputation: 1497

It looks like $orderby is not supported in these type of REST API calls. As a workaround you could use the reverse and first functions after you retrieved the list of updates/revisions.

Below is an example for a single work item.

In a compose use the following expression to retrieve the last updates record.

first(reverse(body('Send_an_HTTP_request_to_Azure_DevOps')['value']))

enter image description here

Upvotes: 1

Related Questions