JPC
JPC

Reputation: 5183

How to pull data from git api?

Can anyone please help me understand this ? I am trying to follow the instruction from git api webpage in attempt to get some commits values from git api. ( I want to get all the branch names, username, commit_parent, and commit_date for all commits from the repository )

Here's below is their instruction :

enter image description here

so.. I installed git and I was able to clone and commit etc. , but say if I want to get some commits related info from this repo -> wesm/D3py what do I need to do exactly ?

I do not understanding how does GET /repos/:owner/:repo/git/commits/:sha statement here work exactly ... ( sorry , if this is too dumb to ask )

GET /repos/wesm/D3py/git/commits/

I have tried to type this into CMD but it does not recognize "GET" where exactly do I need to put this command ? If I use JavaScript how exactly I use this command ?

Upvotes: 0

Views: 210

Answers (1)

Uli Köhler
Uli Köhler

Reputation: 13750

Using jQuery, you can simply use:

$.get("https://api.github.com/repos/wesm/D3py/commits/master", function(data){
    alert(JSON.stringify(data));
})

.get stands for the GET request type. The URL is simply an assembled from the string you gave above.

The code example simply alerts the JSON data.

Upvotes: 1

Related Questions