A short intro to the GitHub API. I created this slides for the GIT MeetUp in Berlin in Dezember 2013.
GitHub APIVersionEye
View Slide
http://developer.github.com/
Use Cases• Login• Fetching Repositories / Files• Crawling Licenses / Change logs and more• Fetching commit dates from tags (release dates)
Authentication• Application Authentication• User Authentication (OAuth - user token)
Rate Limit• 50 per Hour for unauthenticated requests• 5000 per Hour for authenticated requests
Example: Fetching a user
url = "https://api.github.com/user"
Don’t do that!!Use Octokit!
https://www.versioneye.com/ruby/octokit/2.6.3Octokit - Ruby client for the GitHub API
client = Octokit::Client.new( :access_token => token )client.user.to_json
TESTING
https://www.versioneye.com/ruby/vcr/2.8.0VCR
Prepare for failure!
Exceptions• GitHub API can be down• Tokens can be revoked• Rate limit can exceed faster then you think• The API can change
Q / A@RobertReiz