TFS API:minTime过滤器失效,咨询所需API版本及参数适配
Alright, let's clear this up: the minTime parameter does require a specific API version—and that's exactly why it's not working for you in TFS API 3.1.
Here's the breakdown:
- TFS API 3.1 doesn't support the
minTime(or its counterpartmaxTime) filter parameters for build queries. These simply weren't part of the API at that version. - As you noted in the documentation snippet, these filter parameters were first introduced in API version 4.1.
Your original request (using 3.1) looks like this:
GET https://{accountName}.visualstudio.com/{project}/_apis/build/builds?api-version=3.1&minTime=?????
To use minTime, you'll need to update your request to target API 4.1 or a newer version. Here's how that would look (make sure your minTime value follows ISO 8601 date-time format, like 2024-01-01T00:00:00Z):
GET https://{accountName}.visualstudio.com/{project}/_apis/build/builds?api-version=4.1&minTime=YYYY-MM-DDTHH:MM:SSZ
For reference, here's the official note from the 4.1 docs confirming support:
maxTime query string date-time If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified.
minTime query string date-time If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified.
内容的提问来源于stack exchange,提问作者user5855178

