0

I want to read the contents of the file in a repository using the Git API through Java. I am currently able to pull the tree information as specified here https://developer.github.com/v3/git/trees/#get-a-tree But when i use the URL provided in the "tree" object it gives me a response like this on the browser.

{
    "sha": "0f182a0349c4925c57f4ffbd5802b536a3e2588b",
      "size": 45,
      "url": "https://api.github.com/repos/akshayvish/DeleteDuplicates/git/blobs/5e648f5a970ef631c93910282706a231f054689a",
      "content": "Ki5jbGFzcwoKIyBQYWNrYWdlIEZpbGVzICMKKi5qYXIKKi53YXIKKi5lYXIK\n",
      "encoding": "base64"
 }

This JSON doesn't provide me any information about the contents of the file. It is supposed to be pointing to a README.md file. I am using GSON library in my JAVA app to GET data from the GitHub API. I was expecting the whole text of the file as a blob or something within the JSON response instead of just a SHA and some other URL. The URL throws up this JSON again so I don't know how this URL is supposed to be of any help. I know it's designed with a lot of intelligence, but I am just stuck with no info on how to proceed beyond this.

Thanks for any help

LeoNeo
  • 739
  • 1
  • 9
  • 28
  • See if [this post](http://stackoverflow.com/questions/469695/decode-base64-data-in-java) helps any. – PM 77-1 Sep 30 '14 at 00:50
  • @PM 77-1 The link you provided is about decoding a Base64 data. I think I worded my questions incorrectly. I will go ahead and edit my question to make it more relevant. – LeoNeo Oct 01 '14 at 19:44
  • 1
    Thanks for your answer. I didn't understand I had to decode it. My bad! – LeoNeo Oct 02 '14 at 02:42

0 Answers0