We’re wrapping up our #12DaysOfAPIs series! Today, we’re highlighting every developer’s favorite tool, GitHub.
What you can do with the GitHub API
The most common uses for the GitHub API is managing your repos and following updates, feeds and events. However, that’s far from everything that you can do with the API. Basically, anything you can do on GitHub, you can do programmatically through the API. And we say anything, we mean anything. Seriously. Our GitHub API package has a whopping 379 endpoints. See them and test the API for yourself within the browser here.
How to connect to the GitHub API
Step 1: Get a personal GitHub API token
In order to use the GitHub API, you’ll need a GitHub account and credentials. Head over to the GitHub personal access tokens page to generate a (you guessed it!), personal access token.
Give your token a descriptive name and select the scopes that you’d like to grant the token. Then, click “Generate token.” Don’t close the window yet! Once you exit out of this page, you won’t be able to access it again.
Step 2: Test the API with RapidAPI
Now, you can call the GitHub API to perform a function.
1. Go to the RapidAPI GitHub Functions Page:
Open GitHub’s API functions page on RapidAPI. You’ll see a list of endpoints that this API can call.
2. Pick an endpoint and fill in the parameters:
We’ll run the
starRespository endpoint and use it to star one of our favorite repos. You’ll see
starRespository has three parameters:
2a.Fill in the
accessToken: Use the personal account token that you’ve generated on GitHub (we told you not to close that window!). If you have log in for a free account on RapidAPI, we’ll store your account token for you.
2b. Fill in the
user and repositoryName: Since we’re a little biased, we’ll use the following:
3. Call the API to
Now, for the fun part. Click “Test Function” to call the API. Voila! You’ve just starred our repository. Thanks for that 😉
You can export this code into your app. Just log in, pick your language and export the snippet. If you’re connecting to multiple APIs, all you have to do is call rapid.connect vs. calling each individually. Search our marketplace for other APIs to connect with.
Now that we’ve shown you how to connect to the GitHub API, here are some cool things that you can build with it.
Source: HBO GIPHY
Since RapidAPI lets you connect to multiple APIs through one abstraction layer, we’ve focused on project ideas that involve multiple APIs. Enjoy 🙂
- Build a Slack integration that sends a notification every time someone forks your repo
- Connect your GitHub to Facebook’s Graph API to automatically post when you publish a new project
- Use the OneSignal API to send yourself a push notification whenever someone raises an issue