Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify ApiInfo rate limiting usage in docs #1524

Merged
merged 8 commits into from
Jan 1, 2017

Conversation

SeanKilleen
Copy link
Contributor

@SeanKilleen SeanKilleen commented Dec 24, 2016

Supports #1142.

Remaining Work

  • Add a quick section on rate limits to the getting started doc
  • Add links to the Github API rate limit docs
  • Note that authorized clients have a higher rate limit.

If you'd like to break this PR up at all to get some of the basic info in, let me know and I'll switch it up.

@SeanKilleen SeanKilleen changed the title [WIP] Adding ApiInfo descriptions to docs [WIP] Add ApiInfo descriptions to docs Dec 24, 2016
@ryangribble
Copy link
Contributor

I think breaking it up is good, so we can include the basic information asap

var rateLimit = apiInfo?.RateLimit;

var howManyRequestsCanIMakePerHour = rateLimit?.Limit;
var howManyRequestsToIHaveLeft = rateLimit?.Remaining;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ToIHaveLeft => DoIHaveLeft

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice catch, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -69,3 +69,22 @@ If you've authenticated as a given user, you can query their details directly:
```
var user = await client.User.Current();
```

### Too Much of a Good Thing: Dealing with API Rate Limits
Like any popular API, Github needs to throttle some requests. The OctoKit.NET client allows you to get some insight into how many requests you have left and when you can start making requests again. It does this via the `ApiInfo` object and the `GetLastApiInfo()` method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a hyperlink to the github API docs "rate limiting" section? Also maybe it's worth mentioning that an authenticated client has a much higher limit than anonymous

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great feedback; will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been done.

@SeanKilleen SeanKilleen changed the title [WIP] Add ApiInfo descriptions to docs [WIP] Add ApiInfo Rate limiting description to Getting Started Dec 30, 2016
@SeanKilleen
Copy link
Contributor Author

SeanKilleen commented Dec 30, 2016

@ryangribble based on your review:

✅ Added link to Github API
✅ Added note on authenticated rate limits vs anonymous
✅ Fixed the typo.
✅ Updated the PR text/title to reflect the smaller scope you preferred

The build seems to be failing on Travis, but that seems unrelated since I didn't modify the build script. :)

@SeanKilleen SeanKilleen changed the title [WIP] Add ApiInfo Rate limiting description to Getting Started Add ApiInfo Rate limiting description to Getting Started Dec 30, 2016

An authenticated client will have a higher limit than an anonymous client.

For more information on the API and understanding rate limits, you may want to consult [the Github API docs on rate limits](https://developer.github.com/v3/rate_limit/).
Copy link
Contributor

@ryangribble ryangribble Dec 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to link to this page since it provides info about rate limits etc, rather than the link you had (which is the doc for the actual "Get Rate Limit" API call)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryangribble done.

var whenDoesTheLimitReset = rateLimit?.Reset;
```

An authenticated client will have a higher limit than an anonymous client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say "a significantly higher limit" here since its's a big difference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done.

@SeanKilleen
Copy link
Contributor Author

@ryangribble ready for review again at your leisure. Thanks for taking the time to be so thorough. And happy new year!

@ryangribble
Copy link
Contributor

Awesome stuff, thanks so much for the additional clarity in the docs and congrats @SeanKilleen on the first merged contribution of 2017! Happy New Year 🎉

@ryangribble ryangribble merged commit 49c2d52 into octokit:master Jan 1, 2017
@SeanKilleen SeanKilleen deleted the addRateLimitInfoToDocs branch January 2, 2017 17:29
@shiftkey
Copy link
Member

shiftkey commented Jan 9, 2017

@ryangribble ryangribble changed the title Add ApiInfo Rate limiting description to Getting Started Add ApiInfo Rate limiting description to Getting Started docs Jan 15, 2017
@ryangribble ryangribble changed the title Add ApiInfo Rate limiting description to Getting Started docs Claify ApiInfo Rate limiting usage in docs Jan 15, 2017
@ryangribble ryangribble changed the title Claify ApiInfo Rate limiting usage in docs Clarify ApiInfo Rate limiting usage in docs Jan 15, 2017
@ryangribble ryangribble changed the title Clarify ApiInfo Rate limiting usage in docs Clarify ApiInfo rate limiting usage in docs Jan 15, 2017
@nickfloyd nickfloyd added Type: Documentation Improvements or additions to documentation and removed category: docs-and-samples labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants