How to call GitHub REST API from Ubuntu

In brief, I needed to get a list of the members currently in my organization at GitHub.

There are multiple ways to do so, including:

  1. Direct calls to the API from curl
    sudo apt install curl
  2. Python using PyGitHub
    pip install pygithub
  3. Ruby using octokit
    gem install octokit

I tried all 3 and all work in a wonderful way, but I had to choose one eventually

For the simple task I needed of getting members of my GitHub organization, I just used the first method above, using the following call:

curl '' -u "myusername:mypassword" >> myoutput.json

Another example for getting a list of the outside collaborators in my organization:

curl '' -u "myusername:mypassword" >> myoutput.json


per_page=100: controls how many records appear per page (pagination), the maximum I could get is 100, so I had to get 2 pages in total.

page=3: The page number in case you have more than 100 records

-u: To add your GitHub username and password, in case the information you request needs authentication

Note: To convert the json to csv, I just went to and it did a pretty good job for me.


Some Updates:

I did the conversion from json to csv also from Python, since the website tried forcing me to upgrade:

import pandas as pd
df = pd.read_json (r'/home/file1.json')
export_csv = df.to_csv (r'/home/file1.csv')
df = pd.read_json (r'/home/file2.json') #had to get the GitHub API output in 2 times
export_csv = df.to_csv (r'/home/file1.csv', mode='a', header=False) #To append the second file without the header


  1. GitHub API V3 Documentation
  2. octokit Documentation
  3. PyGitHub Documentation
  4. Many articles on StackOverflow and ServerFault

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Ubuntu, Uncategorized and tagged , , , , , , , , , , . Bookmark the permalink.

1 Response to How to call GitHub REST API from Ubuntu

  1. ΞXΤЯ3МΞ says:

    Were is that like button 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s