Agile Zone is brought to you in partnership with:

Lorna Jane Mitchell is a PHP developer, blogger, trainer and evangelist from Leeds in the UK. She is active with phpwomen.org and her local user group PHP North West, and writes for a variety of outlets, including her own blog at lornajane.net. She is an active member of the PHP and open source communities and contributes to the joind.in event feedback project. When she's not at her computer, Lorna enjoys yarn craft, hobby electronics, and her home renovation project. Lorna is a DZone MVB and is not an employee of DZone and has posted 81 posts at DZone. You can read more from them at their website. View Full User Profile

Github API: Issues List

01.10.2011
| 6191 views |
  • submit to reddit
I'm deeply involved with an open source development project (joind.in, the event feedback site) and we recently made the decision to move our issue tracking away from GitHub (because it's awful and meets none of the requirements for a bug tracker, but that's a post for another day). In order to make this happen more smoothly, we wanted to migrate our open issues from github (to JIRA Studio, since Atlassian generously provides accounts here for worthy open source projects - thanks Atlassian!).

I looked around for some export functionality for github but I got a lot of posts complaining it wasn't there. Since I hate applications that take your data and refuse to let you remove it, I was disappointed by this news but further inspection showed that although there might be no "export from github" button, there's an API that more than has it covered. The API returns JSON which is easy to work with from many programming languages, and is perhaps even more powerful and flexible than the simple export I initially expected, so here are some examples.

(as a total aside, why isn't there a thing to turn JSON into human-usable tabular form or similar? I just assumed there would be and googled for one but didn't find it. Suggestions welcome, add a comment!)

I decided we only needed our currently open issues, and these were simple to retrieve: http://github.com/api/v2/json/issues/list/joindin/joind.in/open. Since I'm a PHP programmer, I just did this:

$data = json_decode(file_get_contents('http://github.com/api/v2/json/issues/list/joindin/joind.in/open'));
 
Each of the entries has a comments count too, so for those issues showing a comment count > 1 I grabbed those as well, using http://github.com/api/v2/json/issues/comments/joindin/joind.in/<issue number>

I'll write a post about how we formatted the JIRA import once that has actually been done and shown to work - for now, if you want to get your data out of github, I hope this helps!
References
Published at DZone with permission of Lorna Mitchell, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)