Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github api v3 to fetch contents of a file from a particular branch other than master

Tags:

github

How to use github v3 contents api to fetch a file's contents from a particular branch http://developer.github.com/v3/repos/contents/ i tried these options https://api.github.com/repos/'org_name'/'repo_name'/contents/'file_path' https://api.github.com/repos/'org_name'/'repo_name'/contents/'file_path'/?ref=branch_name or quite a few options , but it fetches the file contents from the masters branch only.

but i need to fetch the contents from a branch other than master. I know i am missing something very basic , but not a figure out what. thanks in advance

like image 225
Sahil Dhankhar Avatar asked Feb 27 '13 14:02

Sahil Dhankhar


1 Answers

That's strange because it seems to work for me. Here is the URL for fetching the index.html file in the gh-pages branch from the tracing-framework repo from Google's GitHub organization:

https://api.github.com/repos/google/tracing-framework/contents/index.html?ref=gh-pages

The index.html file doesn't exist in master.

Can you give the exact URL you are trying?

like image 78
Ivan Zuzak Avatar answered Sep 21 '22 00:09

Ivan Zuzak