Last active
December 22, 2015 22:18
-
-
Save tjl2/6538788 to your computer and use it in GitHub Desktop.
Getting user IDs from the GitHub API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You'll need the rest-client and json gems installed to use this | |
require 'rubygems' | |
require 'rest-client' | |
require 'json' | |
HOSTNAME = '' # Put your GHE hostname here | |
USERNAME = '' # Put your Admin user name here | |
PASSWORD = '' # Put your Admin user password here | |
# Please change this to https, if you are using SSL on your GHE installation | |
api_url = "http://#{USERNAME}:#{PASSWORD}@#{HOSTNAME}/api/v3/" | |
json_response = JSON.parse(RestClient.get(api_url + 'users')) | |
json_response.each do |user| | |
puts "#{user['login']} has ID #{user['id']}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment