Rest API support date range?
Hi,
Is there a way to get a list of builds between a certain date range using the rest api?
http://confluence.jetbrains.net/display/TW/REST+API+Plugin
I didn't see anything in the link above only the ablity to use sinceDate.
Thanks,
Jay
Please sign in to leave a comment.
Jason,
Yes, the only possibility for now is to get the builds using sinceDate and then do the filtering based on the date in the client code.
BTW, can you please explain why do you need this?
Any other feedback on REST API is welcome.
We are using the rest api to collect builds that have specific tags in the past seven days which the sinceDate works but wanted to extend the tool we wrote to allow the user to specify a date range and get those results back. Like you said I could just parse the returned data but when using this on the builds returned you have to dip into the actual build info which is another call to TeamCity which I was trying to avoid.
Jason,
Thank you for the details.
Since it's not that much work I can probably try to add untilDate/untilBuild in some REST API requests in TeamCity 6.5. It will basically do the filtering in the middle layer on the server. However, not sure this is a great addition since the case does not seem a very common one.
That would be great if you could fit it in, otherwise thanks for taking the time to respond and hearing me out.
Handled as TW-15691
I am trying:
http://teamcity/guestAuth/app/rest/builds?sinceDate=20110627T133702-0400&untilDate=20110627T223702-0400
and the results aren't reflecting the date range provided. Can you let me know what I'm doing wrong?
Thanks,
Jay
Yegor,
Can you see my last post? I can't get the date range to work with the rest api plugin.
Thanks,
Jay
Jason,
Sorry for not replying in timely manner.
The correct format was ment as mentioned in the issue comment.
In your case that seems to map to:
http://teamcity/guestAuth/app/rest/builds?locator=sinceDate:20110627T133702-0400,untilDate:20110627T223702-0400
Thanks Yegor, I'll give that a try. It's not very obvious in the documentation when to use "locator=" and when not to use it. Can you update the documentation? The documentation also doesn't mention anything about "untilDate"
http://confluence.jetbrains.net/display/TW/REST+API+Plugin
Thanks,
Jay
Hi Yegor,
Is the date range supported for build in a particular build type?
For example this doesn't seem to be working:
http://teamcity/guestAuth/app/bc/rest/buildTypes/id:bt125470/builds?locator=sinceDate:20110821T000000-0400,untilDate:20110822T115959-0400
Thanks,
Jay
Looks like the untilDate only works for builds locator. Can anyone tell me otherwise?
Jason,
So far "locator" parameter is not supported for "buildTypes/..." URLs, you can use "builds/..." with "buildType:btXXX" locator part.
Jason,
It's true that the documentation is scarse and needs improvement. However, I did not find any references in the current documentation page to "locator=" other then in "/app/rest/builds/..." URLs where it is supported.