I’m new to powershell, json and Azure Devops Rest api and don’t know how to get the pipeline buildNumber if I know the date and time of when the build was queued. I have tried:
$AllQueueTimes = (Invoke-RestMethod https://dev.azure.com/{organization}/{project}/_apis/build/Builds?api-version=5.1-preview.2 -UseDefaultCredential).value.'queueTime'
Write-Output "IndexOf($AllQueueTimes, "2020-06-08T14:12:38.1584424Z")"
I wasn’t able to use the “2020-06-08T14:12:38.1584424Z” string in the invokation like this:
https://dev.azure.com/{organization}/{project}/_apis/build/Builds?queueTime=2020-06-08T14:12:38.1584424Zapi-version=5.1-preview.2
Not to be curt; however, this seems to be more of a question related to calling the Azure DevOps Rest API.
As I have been learning in my own journey to uncover the great world of APIs and query such APIs, I have used PostMan a great deal to test my calls to the API before I go on and code them. Postman, provides a relatively easy user interface to make calls to APIs and test.
My suggestion would be ironing out your url (request - w/query) with Postman and then once you know its tested and returning the correct info, plop that in to your code.
https://www.postman.com/