Connecting to GitHub#
First Steps with GitHub#
An account is not necessary for the GitHub API. If you'd like you can set up an account with GitHub.
Costs
DataDistillr's GitHub form is specifically configured for the free version of the GitHub API. To connect to paid versions try to use the Custom API form, or contact us for assistance.
Rate Limits
The GitHub API has rate limits. Once you exceed a certain number of requests in a specific period, GitHub returns an error.
How to Connect DataDistillr to GitHub#
To set up a data source connection for GitHub, you will need to have:
- A unique name for your data source connection to be used in queries.
Data Source Form#
To locate the GitHub form, follow the steps in Connecting Your Data to DataDistillr. When you get to the window to choose the data source type, select API as shown below.
On the API screen, select GitHub from list of API forms as shown in the image below.
The following form will appear. Instructions can be found below on how to find the information required to fill each field on the GitHub API form.
Once you have filled out all the fields, press the green 'Save' button, and your API will be connected!
Name#
Enter any name that will help you recognize this data source from within your query window.
Acceptable characters include
- lowercase alphanumeric characters
- underscores
Endpoints#
The table below shows a list of endpoints available to connect to within the DataDistillr application. If you need to connect to any endpoints not listed in the table below, please use the Custom API Form.
Endpoint | URL Params | Required Params | Description |
---|---|---|---|
users |
Lists all users, in the order that they signed up on GitHub | ||
search |
searchGroup | 'q' | The GitHub Search API lets you to search for the specific item efficiently |
repos |
Lists all public repositories in the order that they were created. | ||
org |
org | Get info on an organization. |
Nav Tree#
The endpoint above will display as follows in the nav tree once your API has successfully connected.
Sample Queries#
The following queries are intended to help you get started, and make life simpler querying within your API.
For the following examples, suppose that my GitHub data source was called mygithubapi
and I want to query an endpoint.
The endpoint goes after the GitHub data source name:
Get Users Endpoint#
Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.
Search Endpoint#
The Search API helps you search for the specific item you want to find, such as finding a user or specific file in a repository.
Info
This endpoint is different than the other endpoints. The q
param is used to create a search query.
Check out GitHub's Search API Docs for more info.
Warning: This endpoint has pagination and can cause you to hit your rate limits very quickly.
For example, if you're looking for a list of popular users, you might try the following query. This query searches for users with the name Tom. The results are restricted to users with more than 42 repositories and over 1,000 followers.
SELECT *
FROM `mygithubapi`.`search`
WHERE searchGroup = 'users'
AND q = 'tom+repos:%3E42+followers:%3E1000' LIMIT 1000
Get Repos Endpoint#
Lists all public repositories in the order that they were created.
Get Org Endpoint#
The event stream can be queried and filtered by time, priority, sources and tags.