Basically, I need to get JSON data from Git’s web API. Great! Did that.
So, now I have a ListView in an android app, each list element is the title and first 140 characters from the json (jsonObject.getString(“title”/”body”)). When the user clicks on a list element, a dialog with all the comments in supposed to load.
So each issue (JSONObject) should have it’s own comments, and indeed I can see the comments in the HTML version of the repo. However, how the heck do I download the comments in JSON form? So far, here’s the “comments” element from inside the original issues JSON object:
"comments": 1,
"milestone": null,
"number": 18,
So, doing the stuff in android shouldn’t be a big problem. I can detect the user’s list item choice, and then get any string inside the JSON object (I figure ID is key in helping to find the comments for that issue). But, I can’t figure out how I’m supposed to use GET like it says on this page under HTTP verbs (http://developer.github.com/v3/), I also can’t sort out how to utilize the command as seen on this page under Get a Single comment (http://developer.github.com/v3/issues/comments/).
Lastly, I am using a PHP script on a webpage to access the original JSON. So I can envision a situation where I run another PHP script to get the comments JSON based on the list choice the user made (getID) and then work with it on the screen as need. But I can’t do that without knowing how to get the comments!
Well, the url to get all the issues is something like this
https://api.github.com/repos/octocat/Hello-World/issues
as you can see you’ll receive a list of issues.
After that just select the issue (let’s say the number 26 that has 2 comments) and just add to the url “26/comments”
https://api.github.com/repos/octocat/Hello-World/issues/26/comments
and you’ll have your comments!