Skip to content
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commit 84d8813

Browse files
committed
added object api and changed the name of it
1 parent 91a4b00 commit 84d8813

5 files changed

Lines changed: 288 additions & 5 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h1>Welcome to the GitHub Developer site</h1>
8181
</div>
8282

8383
<div class='episode'>
84-
<div class="title">File API</div>
84+
<div class="title"><a href="p/object.html">Object API</a></div>
8585
<p>Getting full versions of specific files and trees in your Git repositories.</p>
8686
</div>
8787

p/object.html

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7+
<title>Develop.GitHub - </title>
8+
<script type="text/javascript" src="../js/jquery-1.2.6.pack.js"></script>
9+
<script type="text/javascript" src="../js/thickbox-compressed.js"></script>
10+
<script type="text/javascript" src="../js/jquery.corner.js"></script>
11+
12+
<link rel="stylesheet" href="../css/screen.css" type="text/css" media="screen, projection">
13+
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
14+
<!--[if IE]>
15+
<link rel="stylesheet" href="../css/ie.css" type="text/css" media="screen, projection">
16+
<![endif]-->
17+
18+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8"/>
19+
<link rel="stylesheet" href="../css/thickbox.css" type="text/css" media="screen"/>
20+
</head>
21+
22+
<body>
23+
<div class="container">
24+
25+
<div class="span-21" id="header">
26+
<div class="span-10">
27+
<a href="/"><img src="../images/develop-github.png" alt="github learn logo" /></a>
28+
</div>
29+
30+
<div class="span-11 last">
31+
<div id="links">
32+
<a href="http://github.com">home</a>
33+
<a href="http://github.com/login">login</a>
34+
<a href="http://github.com/signup">signup!</a>
35+
</div>
36+
</div>
37+
</div>
38+
39+
<div class="span-21 last content">
40+
<h2 id='git_object_api'>Git Object API</h2>
41+
42+
<h3 id='trees'>Trees</h3>
43+
44+
<p>Can get the contents of a tree by tree sha</p>
45+
46+
<pre><code>tree/show/:user/:repo/:tree_sha</code></pre>
47+
48+
<p>To get a listing of the root tree for the facebox project from our commit listing, we can call this:</p>
49+
50+
<pre><code>$ curl http://github.com/api/v2/yaml/tree/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4df70da4
51+
---
52+
tree:
53+
- name: .gitignore
54+
sha: e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf
55+
mode: &quot;100644&quot;
56+
type: blob
57+
- name: README.txt
58+
sha: d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
59+
mode: &quot;100644&quot;
60+
type: blob
61+
- name: b.png
62+
sha: f184e6269b343014f58694093b55558dd5dde193
63+
mode: &quot;100644&quot;
64+
type: blob
65+
- name: bl.png
66+
sha: f6271859d51654b6fb2719df5fe192c8398ecefc
67+
mode: &quot;100644&quot;
68+
type: blob</code></pre>
69+
70+
<h3 id='blobs'>Blobs</h3>
71+
72+
<p>Can get the data about a blob by tree sha and path</p>
73+
74+
<pre><code>blob/show/:user/:repo/:tree_sha/:path</code></pre>
75+
76+
<p>For example, to get the README.txt metadata from a specific tree in Facebox:</p>
77+
78+
<pre><code>$ curl http://localhost:3000/api/v2/yaml/blob/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4d/README.txt
79+
---
80+
blob:
81+
name: README.txt
82+
size: 178
83+
sha: d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
84+
mode: &quot;100644&quot;
85+
mime_type: text/plain
86+
data: |
87+
Please visit http://famspam.com/facebox/ or open index.html in your favorite browser.
88+
89+
Need help? Join our Google Groups mailing list:
90+
http://groups.google.com/group/facebox/</code></pre>
91+
92+
<h3 id='raw_git_data'>Raw Git Data</h3>
93+
94+
<p>You can get the contents of a blob with the blobs s via:</p>
95+
96+
<pre><code>blob/show/:user/:repo/:sha</code></pre>
97+
98+
<p>It is important to note that it doesn&#8217;t matter which type you specify (yaml, xml, json), the output will simply be the raw output.</p>
99+
100+
<p>Here is an example of getting a README file from Facebox:</p>
101+
102+
<pre><code>$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
103+
Please visit http://famspam.com/facebox/ or open index.html in your favorite browser.
104+
105+
Need help? Join our Google Groups mailing list:
106+
http://groups.google.com/group/facebox/</code></pre>
107+
108+
<p>You can actually get raw trees and commits this way, too. If you give it a tree SHA instead, you&#8217;ll get this:</p>
109+
110+
<pre><code>$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4d
111+
100644 blob e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf .gitignore
112+
100644 blob d4fc2d5e810d9b4bc1ce67702603080e3086a4ed README.txt
113+
100644 blob f184e6269b343014f58694093b55558dd5dde193 b.png
114+
100644 blob f6271859d51654b6fb2719df5fe192c8398ecefc bl.png
115+
100644 blob 31f204fc451cd9dd5cfdadfad2d86ed0e1104882 br.png
116+
100755 blob 08f6f1fce2f6a02dcb15b6c66244470794587bb0 build_tar.sh
117+
100755 blob 87b4f8bd699386e3a6fcc2e50d7c61bfc4aabb8d closelabel.gif
118+
100644 blob 97ebe3cab3eab76253f9cc5fc894b339456da86e facebox.css
119+
100644 blob 2ea88c96ebb00d38d5ae6abad57c917f156802cc facebox.js
120+
100644 blob dc61a86c3f342b930f0a0447cae33fee812e27d3 faceplant.css
121+
100644 blob 355442b51047a30479c21096e06e0906e4e9a4ee index.html
122+
100644 blob ebe02bdd357c337e0e817fcbce2a034a54a13287 jquery.js
123+
100755 blob f864d5fd38b7466c76b5a36dc0e3e9455c0126e2 loading.gif
124+
100644 blob e41cfe5c654e8e05ad46f15af1c462a1360e9764 logo.png
125+
040000 tree 82e3a754b6a0fcb238b03c0e47d05219fbf9cf89 releases
126+
100644 blob 98d3e92373d1bc541e7f516e5e73b645a991ddc2 remote.html
127+
040000 tree bbf747873075ac28667d246491ffdefbd314fe4f screenshots
128+
100644 blob e58b35b362ce5347bb5064e91a3bf8e4fed4f6ef shadow.gif
129+
100644 blob 63459bb418f5f6d896a8eb925c01f45024933ed6 stairs.jpg
130+
100644 blob 38756c5ecc3ce53b8da9555a497bd9cc20b1b1c9 test.html
131+
100644 blob d99c8f6c6eaa12d7b49a20f41f08a5006f3ea8b7 tl.png
132+
100644 blob e99b6ec8310e859fd27519694f04e1babf2ab2c4 tr.png</code></pre>
133+
134+
<p>Here is an example of a commit:</p>
135+
136+
<pre><code>$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/4bf7a39e8c4ec54f8b4cd594a3616d69004aba69
137+
tree f7a5de2e224ec94182a3c2c081f4e7f35f70da4d
138+
parent cd13d9a61288dceb0a7aa73b55ed2fd019f4f1f7
139+
parent 3211367cab73233af66dac2710c94682f3f3b9b2
140+
author Chris Wanstrath &lt;[email protected]&gt; 1213837237 -0700
141+
committer Chris Wanstrath &lt;[email protected]&gt; 1213837237 -0700
142+
143+
Merge branch &#39;master&#39; of git://github.com/webweaver/facebox into webweaver/master</code></pre><br/><br/><hr/><div class="span-21 last">&nbsp;</div><hr/>
144+
</div>
145+
146+
<div id="footer" class="span-21">
147+
<div class="info span-12">
148+
<div class="links">
149+
<a href="http://github.com/blog/148-github-shirts-now-available">T-Shirts</a> |
150+
<a href="http://github.com/blog">Blog</a> |
151+
<a href="http://support.github.com/">Support</a> |
152+
<a href="http://github.com/training">Git Training</a> |
153+
<a href="http://github.com/contact">Contact</a> |
154+
<a href="http://groups.google.com/group/github/">Google Group</a> |
155+
<a href="http://github.wordpress.com">Status</a>
156+
</div>
157+
<div class="company">
158+
GitHub is <a href="http://logicalawesome.com/">Logical Awesome</a> &copy;2009 | <a href="http://github.com/site/terms">Terms of Service</a> | <a href="http://github.com/site/privacy">Privacy Policy</a>
159+
</div>
160+
</div>
161+
<div class="fork span-7">
162+
This website is <a href="http://github.com/develop/develop.github.com">open source</a>.
163+
Please help us by forking the project and adding to it.
164+
</div>
165+
</div>
166+
167+
</div>
168+
169+
<script type="text/javascript">
170+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
171+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
172+
</script>
173+
<script type="text/javascript">
174+
var pageTracker = _gat._getTracker("UA-3769691-2");
175+
pageTracker._initData();
176+
pageTracker._trackPageview();
177+
</script>
178+
179+
</body>
180+
</html>

p/users.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ <h2 id='users_api'>Users API</h2>
4141

4242
<p>API for accessing and modifying user information.</p>
4343

44-
<p>All the URLs here are prefixed with &#8216;/api/v2/:format&#8217;.</p>
45-
4644
<h3 id='searching_for_users'>Searching for Users</h3>
4745

4846
<p>The route for user searching is:</p>

pages/object.markdown

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
## Git Object API ##
2+
3+
### Trees ###
4+
5+
Can get the contents of a tree by tree sha
6+
7+
tree/show/:user/:repo/:tree_sha
8+
9+
To get a listing of the root tree for the facebox project from our commit listing, we can call this:
10+
11+
$ curl http://github.com/api/v2/yaml/tree/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4df70da4
12+
---
13+
tree:
14+
- name: .gitignore
15+
sha: e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf
16+
mode: "100644"
17+
type: blob
18+
- name: README.txt
19+
sha: d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
20+
mode: "100644"
21+
type: blob
22+
- name: b.png
23+
sha: f184e6269b343014f58694093b55558dd5dde193
24+
mode: "100644"
25+
type: blob
26+
- name: bl.png
27+
sha: f6271859d51654b6fb2719df5fe192c8398ecefc
28+
mode: "100644"
29+
type: blob
30+
31+
### Blobs ###
32+
33+
Can get the data about a blob by tree sha and path
34+
35+
blob/show/:user/:repo/:tree_sha/:path
36+
37+
For example, to get the README.txt metadata from a specific tree in Facebox:
38+
39+
$ curl http://localhost:3000/api/v2/yaml/blob/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4d/README.txt
40+
---
41+
blob:
42+
name: README.txt
43+
size: 178
44+
sha: d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
45+
mode: "100644"
46+
mime_type: text/plain
47+
data: |
48+
Please visit http://famspam.com/facebox/ or open index.html in your favorite browser.
49+
50+
Need help? Join our Google Groups mailing list:
51+
http://groups.google.com/group/facebox/
52+
53+
54+
55+
### Raw Git Data ###
56+
57+
You can get the contents of a blob with the blobs s via:
58+
59+
blob/show/:user/:repo/:sha
60+
61+
It is important to note that it doesn't matter which type you specify (yaml, xml, json), the output will simply be the raw output.
62+
63+
Here is an example of getting a README file from Facebox:
64+
65+
$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/d4fc2d5e810d9b4bc1ce67702603080e3086a4ed
66+
Please visit http://famspam.com/facebox/ or open index.html in your favorite browser.
67+
68+
Need help? Join our Google Groups mailing list:
69+
http://groups.google.com/group/facebox/
70+
71+
You can actually get raw trees and commits this way, too. If you give it a tree SHA instead, you'll get this:
72+
73+
$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4d
74+
100644 blob e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf .gitignore
75+
100644 blob d4fc2d5e810d9b4bc1ce67702603080e3086a4ed README.txt
76+
100644 blob f184e6269b343014f58694093b55558dd5dde193 b.png
77+
100644 blob f6271859d51654b6fb2719df5fe192c8398ecefc bl.png
78+
100644 blob 31f204fc451cd9dd5cfdadfad2d86ed0e1104882 br.png
79+
100755 blob 08f6f1fce2f6a02dcb15b6c66244470794587bb0 build_tar.sh
80+
100755 blob 87b4f8bd699386e3a6fcc2e50d7c61bfc4aabb8d closelabel.gif
81+
100644 blob 97ebe3cab3eab76253f9cc5fc894b339456da86e facebox.css
82+
100644 blob 2ea88c96ebb00d38d5ae6abad57c917f156802cc facebox.js
83+
100644 blob dc61a86c3f342b930f0a0447cae33fee812e27d3 faceplant.css
84+
100644 blob 355442b51047a30479c21096e06e0906e4e9a4ee index.html
85+
100644 blob ebe02bdd357c337e0e817fcbce2a034a54a13287 jquery.js
86+
100755 blob f864d5fd38b7466c76b5a36dc0e3e9455c0126e2 loading.gif
87+
100644 blob e41cfe5c654e8e05ad46f15af1c462a1360e9764 logo.png
88+
040000 tree 82e3a754b6a0fcb238b03c0e47d05219fbf9cf89 releases
89+
100644 blob 98d3e92373d1bc541e7f516e5e73b645a991ddc2 remote.html
90+
040000 tree bbf747873075ac28667d246491ffdefbd314fe4f screenshots
91+
100644 blob e58b35b362ce5347bb5064e91a3bf8e4fed4f6ef shadow.gif
92+
100644 blob 63459bb418f5f6d896a8eb925c01f45024933ed6 stairs.jpg
93+
100644 blob 38756c5ecc3ce53b8da9555a497bd9cc20b1b1c9 test.html
94+
100644 blob d99c8f6c6eaa12d7b49a20f41f08a5006f3ea8b7 tl.png
95+
100644 blob e99b6ec8310e859fd27519694f04e1babf2ab2c4 tr.png
96+
97+
Here is an example of a commit:
98+
99+
$ curl http://github.com/api/v2/yaml/blob/show/defunkt/facebox/4bf7a39e8c4ec54f8b4cd594a3616d69004aba69
100+
tree f7a5de2e224ec94182a3c2c081f4e7f35f70da4d
101+
parent cd13d9a61288dceb0a7aa73b55ed2fd019f4f1f7
102+
parent 3211367cab73233af66dac2710c94682f3f3b9b2
103+
author Chris Wanstrath <[email protected]> 1213837237 -0700
104+
committer Chris Wanstrath <[email protected]> 1213837237 -0700
105+
106+
Merge branch 'master' of git://github.com/webweaver/facebox into webweaver/master
107+

pages/users.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
API for accessing and modifying user information.
44

5-
All the URLs here are prefixed with '/api/v2/:format'.
6-
75
### Searching for Users ###
86

97
The route for user searching is:

0 commit comments

Comments
 (0)