Below API returns all the versions of a specific package. In order to get the latest version of that package, I can use the isLatest:true data from the returned response.
But I was wondering if there is way to only get the latest version in the response rather than all the version? Is it possible?
If there is no possibility of that, then a second question - Will latest version be always the first item in the response? (I assume there is a limit to the return item count (1000?) so I was wondering if one API call would always be sufficient if I need to get the latest version.
The answer is yes. The latest version be always the first item in the response.
As test, I published a test package to my feed with versions
1.0.0
,2.0.0
, then published the version1.0.1-preview1.2
,1.0.1
. But Azure devops will be sorted in order of package version:So, we could use REST API with powershell parameter
Select-Object -first 1
to get the latest package version:The test result: