Can I use Rest APi to get information

I am relatively new to Teamcity. I have created a project and configurations, run builds, etc. For a release, I need to create a report to send out. There will be a number of items on it, (Artifact info, etc), but in particular (for one project), I want to list all the configurations, the last build #, and the url for each configuration, to a report. What is the best way of doing this (they use Ant and Python here). Can someone give me (or point me to), an example of this (using the Rest API?). How to get the info, and then how to export this to a report\txt file. Basically, I am looking for the script example to do this.

3 comments
Comment actions Permalink

Hi Lou,

The rest api does support this, check out the api usage based on your TeamCity version.  I built a ruby gem that makes using the api easier so I would give that a try as ruby has some nice gems to generate reports that usually just require you to pass it a ruby data structure to represent the data.  I would also check out the full list of TeamCity plugins available to see if anything fits your need.  Good luck.

-- Jay

0
Comment actions Permalink

In the Rest API documentation...http://confluence.jetbrains.com/display/TW/REST+API, there is this...
List of Build Configurations of a project: GET http://teamcity:8111/httpAuth/app/rest/projects/<projectLocator>/buildTypes.

Can I start with this?  In Python (new to Python also, thats why I am looking for examples), array name = the above statement (<projectLocator> = project name?).  Do I need the 'GET'?
Would that get me the list of all the configurations for the project?  Then if would be a matter of for each of those array items get the latest build #, and url (are there gets for those also?)

0
Comment actions Permalink

I don't know python so I wouldn't be able to help which is why I suggested ruby.  Up to you though.

Yes, that endpoint should work.  The Advanced Rest Client google extension is a nice thing to use when experimenting and seeing what data comes back.  I prefer working with json.

0

Please sign in to leave a comment.