1
votes

I'm attempting to call the Azure DevOps API to determine the outcome for test runs using the URL, narrowing the results to a single releaseEnvId:

https://dev.azure.com/organisation/project/_apis/test/runs?api-version=5.0&releaseEnvIds=12345&minLastUpdatedDate=2019-05-17T14:00:00.910Z&maxLastUpdatedDate=2019-05-15T14:00:00.910Z

The API request requires two mandatory date-time fields, but the doc at https://docs.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-rest-5.0 does not specify the format:

maxLastUpdatedDate

minLastUpdatedDate

The date-time format I am specifying is wrong because the error comes up:

{"$id":"1","innerException":null,"message":"Invalid dates specified.","typeName":"Microsoft.TeamFoundation.TestManagement.WebApi.InvalidPropertyException, Microsoft.TeamFoundation.TestManagement.WebApi","typeKey":"InvalidPropertyException","errorCode":0,"eventId":3000}

As I understand the doc, the min date must be less than 7 days from the max. if I add garbage to the date formats then it produces a proper date parsing error.

1

1 Answers

3
votes

The format you provided it's good but in your example the minLastUpdatedate (5/17) it's after the maxLastUpadeDate (5/15) in it should be the opposite. try to replace the values and it should work.

BTW - you specified the date in the full format, the API should works also with date only - 2019-05-15 or with a time - 2019-05-15T14:00:00.