Skip to content

Commit fe68ac1

Browse files
committed
Merge pull request github#225 from github/tweak-getting-started-guide
Tweak "Getting Started" guide
2 parents ba91d41 + e46bb75 commit fe68ac1

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

content/guides/getting-started.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Mmmmm, tastes like JSON. Let's include the `-i` flag to include headers:
5353
Content-Length: 692
5454
Last-Modified: Tue, 30 Oct 2012 18:58:42 GMT
5555

56-
There's a few interesting bits in the response headers. As expected, the
56+
There are a few interesting bits in the response headers. As expected, the
5757
`Content-Type` is `application/json`.
5858

5959
Any headers beginning with `X-` are custom headers, and are not included in the
@@ -64,11 +64,11 @@ for the response. Media types have helped us version our output in API v3. We'll
6464
talk more about that later.
6565
* Take note of the `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers. This
6666
pair of headers indicate how many requests a client can make in a rolling hour
67-
and how many of those requests it has already spent.
67+
and how many of those requests the client has already spent.
6868

6969
## Authentication
7070

71-
Unauthenticated clients can make 60 calls per hour. To get more, we'll need to
71+
Unauthenticated clients can make 60 requests per hour. To get more, we'll need to
7272
_authenticate_. In fact, doing anything interesting with the GitHub API requires
7373
authentication.
7474

@@ -83,20 +83,24 @@ username and password via Basic Authentication.
8383
The `-u` flag sets the username, and cURL will prompt you for the password. You
8484
can use `-u "username:password"` to avoid the prompt, but this leaves your
8585
password in shell history and isn't recommended. When authenticating, you
86-
should see your rate limit bumped to 5000 requests an hour, as indicated in the
86+
should see your rate limit bumped to 5,000 requests an hour, as indicated in the
8787
`X-RateLimit-Limit` header.
8888

8989
In addition to just getting more calls per hour, authentication is the key to
9090
reading and writing private information via the API.
9191

9292
### Get your own user profile
9393

94-
When properly authenticated, you can grab your own user profile:
94+
When properly authenticated, you can take advantage of the permissions
95+
associated with your GitHub account. For example, try getting your own
96+
user profile:
9597

9698
curl -i -u <your_username> https://api.github.com/user
9799

98-
This time, in addition to the same set of information we retrieved for defunkt
99-
earlier, you should see a `plan` object on the response:
100+
This time, in addition to the same set of public information we
101+
retrieved for defunkt earlier, you should also see the non-public
102+
information for your user profile. For example, you see a `plan` object
103+
on the response:
100104

101105
...
102106
"plan": {
@@ -110,31 +114,34 @@ earlier, you should see a `plan` object on the response:
110114

111115
### OAuth
112116

113-
While convenient, Basic Auth isn't ideal because you shouldn't give your GitHub
117+
While convenient, Basic Authentication isn't ideal because you shouldn't give your GitHub
114118
username and password to anyone. Applications that need to read or write
115119
private information using the API on behalf of another user should use [OAuth][oauth].
116120

117121
Instead of usernames and passwords, OAuth uses _tokens_. Tokens provide two big
118122
features:
119123

120124
* **Revokable access**: users can revoke authorization to third party apps at any time
121-
* **Limited access**: users can specify what access a token provides when they
122-
authorize a third party app
123-
124-
Normally, tokens are created via a [web flow][webflow]. An application will send
125-
users to GitHub to log in. GitHub will present a dialog indicating the name of the
126-
app, as well as what information it has access to. After a user authorizes access,
127-
GitHub redirects the user back to the application:
125+
* **Limited access**: users can review the specific access that a token
126+
will provide before authorizing a third party app
127+
128+
Normally, tokens are created via a [web flow][webflow]. An application
129+
sends users to GitHub to log in. GitHub then presents a dialog
130+
indicating the name of the app, as well as the level of access the app
131+
has once it's authorized by the user. After a user authorizes access, GitHub
132+
redirects the user back to the application:
128133
![](/images/oauth_prompt.png)
129134

130135
You don't need to set up the entire web flow to begin working with OAuth tokens.
131-
The [Authorizations API][authorizations api] makes it simple to use Basic Auth
132-
to create an OAuth token. Try pasting and running
136+
The [Authorizations API][authorizations api] makes it simple to use Basic Authentication
137+
to create an OAuth token. Try pasting and running the following command:
133138

134139
curl -i -u <your_username> \
135140
-d '{"scopes": ["repo"]}' \
136141
https://api.github.com/authorizations
137142

143+
You should see output similar to this:
144+
138145
HTTP/1.1 201 Created
139146
Server: nginx/1.0.14
140147
Date: Wed, 14 Nov 2012 14:04:24 GMT
@@ -217,8 +224,10 @@ Or, we can list repositories for an organization:
217224

218225
The information returned from these calls will depend on how we authenticate:
219226

220-
* Using Basic Auth, everything the user has access to see on github.com
221-
* Using OAuth, private repositories are only returned if the OAuth token contains 'repo' scope.
227+
* Using Basic Authentication, the response includes all repositories the
228+
the user has access to see on github.com.
229+
* Using OAuth, private repositories are only returned if the OAuth token
230+
contains the `repo` [scope][scopes].
222231

223232
As the [docs][repos-api] indicate, these methods take a `type` parameter that
224233
can filter the repositories returned based on what type of access the user has
@@ -227,7 +236,7 @@ organization repositories, or repositories the user collaborates on via a team.
227236

228237
curl -i "https://api.github.com/users/technoweenie/repos?type=owner"
229238

230-
In this example, we can grab only those repositories that technoweenie owns, not the
239+
In this example, we grab only those repositories that technoweenie owns, not the
231240
ones on which he collaborates. Note the quoted URL above. Depending on your
232241
shell setup, cURL sometimes requires a quoted URL or else it ignores the
233242
querystring.
@@ -255,8 +264,8 @@ templates].
255264

256265
The resulting repository will be found at `https://github.com/<your
257266
username>/blog`. To create a repository under an organization for which you're
258-
an owner, just change the API method from `/user/repos` to `/orgs/{org
259-
name}/repos`.
267+
an owner, just change the API method from `/user/repos` to `/orgs/<org
268+
name>/repos`.
260269

261270
Next, let's fetch our newly created repository:
262271

@@ -271,7 +280,7 @@ Next, let's fetch our newly created repository:
271280
Oh noes! Where did it go? Since we created the repository as _private_, we need
272281
to authenticate in order to see it. If you're a grizzled HTTP user, you might
273282
expect a `403` instead. Since we don't want to leak information about private
274-
repositories, the GitHub API returns a `404` instead, as if to say "we can
283+
repositories, the GitHub API returns a `404` in this case, as if to say "we can
275284
neither confirm nor deny the existence of this repository."
276285

277286
## Issues
@@ -288,7 +297,7 @@ authenticated user. To see all your issues, call `GET /issues`:
288297
https://api.github.com/issues
289298

290299
To get only the issues under one of your GitHub organizations, call `GET
291-
/orgs/{org}/issues`:
300+
/orgs/<org>/issues`:
292301

293302
curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
294303
https://api.github.com/orgs/rails/issues
@@ -396,8 +405,8 @@ from the issue we provide.
396405

397406
## Conditional requests
398407

399-
A big part of being a good API citizen is respecting rate limits and caching
400-
information that does not change. The API supports [conditional
408+
A big part of being a good API citizen is respecting rate limits by
409+
caching information that hasn't changed. The API supports [conditional
401410
requests][conditional-requests] and helps you do the right thing. Consider the
402411
first call we made to get defunkt's profile:
403412

content/guides/index.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ This section of the documentation is intended to get you up-and-running with
88
real-world GitHub API applications. We'll cover everything you need to know, from
99
authentication, to manipulating results, to combining results with other services.
1010

11-
Every tutorial here will have a project, and every project will be stored and
12-
documented in our public `platform-samples` repo:
11+
Every tutorial here will have a project, and every project will be
12+
stored and documented in our public
13+
[platform-samples](https://github.com/github/platform-samples) repo.
1314

14-
https://github.com/github/platform-samples
15-
16-
Feel free to fork, clone, and improve these guides.
15+
Feel free to fork, clone, and improve these guides.

0 commit comments

Comments
 (0)