Skip to content

Instantly share code, notes, and snippets.

@timsavery
Created February 24, 2012 15:04
Show Gist options
  • Save timsavery/1901490 to your computer and use it in GitHub Desktop.
Save timsavery/1901490 to your computer and use it in GitHub Desktop.
Authenticate & Get Projects from TeamCity API (Ruby)
require 'rubygems'
require 'rest-client'
require 'xmlsimple'
host = ''
login = ''
password = ''
authresponse = RestClient.post 'http://' + host + '/rest/user/login', :login => login, :password => password
cookies = authresponse.cookies
projectresponse = RestClient.get 'http://' + host + '/rest/project/all', { :cookies => cookies }
projects = XmlSimple.xml_in(projectresponse.body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment