If you work in the tech industry, especially in the area of software development, you might use or at least be familiar with Rally. It's a web-based project management tool that follows the principles of the Agile development lifecycle. I've even seen Rally used to organize and track projects that were not actually software development projects. I've seen this because I do not specifically work in the area of software development, yet I use Rally anyway.
I don't really care much for its web interface though. In my opinion, it often takes way more clicking around in the GUI than it should. Sometimes the GUI isn't intuitive and you end up making mistakes like deleting an entire User Story when you meant to just delete a single Task.
So I started thinking to myself. "Self," I said. "I wonder if Rally has a REST API? If they did, I could interface with it in Powershell and automate a lot of simple tasks."
Well lo and behold they sure do. Let's see how freaking simple this is with Powershell:
$Rally = New-WebServiceProxy https://rally1.rallydev.com/slm/webservice/1.41/meta/132645/rally.wsdl -Credential (Get-Credential) -Namespace Rally
And just like that, we're connected to Rally. To verify, you could check the currently logged on user:
Now, let's pull some data from Rally. Let's retrieve, say, my 20 most recently-created Tasks in Rally:
PS C:\> $Query = $Rally.Query($null, "Task", "(Owner.Name = `"firstname.lastname@example.org`")", "CreationDate desc", $True, 1, 20)
PS C:\> $Query.Results.Name
Write some code
Write some more code
Fix this defect
Fix that defect
Fix all the defects
Save the company from bankruptcy
Catch the guy who keeps running the copier out of paper and not refilling it
Playing with REST services and web services is so delightfully easy with Powershell.
A reader emailed me recently about this post and informed that instead of using New-WebServiceProxy, using Invoke-RestMethod works better:
$url = "https://rally1.rallydev.com/slm/webservice/v2.0/task/?query=(Owner = ""email@example.com"")&fetch=true&start=1&pagesize=20&order=CreationDate desc"
$Rally = Invoke-RestMethod -Uri $url -Credential (Get-Credential)
$Query = $Rally.QueryResult