Github API: Issues List
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!
Regarding your question about “pretty printing” JSON.
I’m not sure what exactly you’re looking for, but theres for example a Firefox addon: https://addons.mozilla.org/en-US/firefox/addon/10869/. Also, Zend_Json from the Zend Framework has a Zend_Json::prettyPrint() method.
May be http://jsonlint.com/ is the thing you are looking for.
Thank you for your post.
Jan: Ah that firefox plugin looks useful. I was wondering what a “normal” person would be able to do to retrieve their JSON data – thanks :)
Victim: That’s a nice tool too, for scripters, thanks for your comment!
Any idea how to do this in v3 github API?
Sorry, I haven’t used the github API again since – although maybe I should look into it. I think the older APIs are still supported though, so perhaps you could try those?