• Home
  • Uncategorized
  • Tutorial: How to use google-apps-manager for easy access to Google Apps SDK from linux console

Tutorial: How to use google-apps-manager for easy access to Google Apps SDK from linux console

google-apps-manager is a console based tool to access the Google apps administrative SDK.

An example of its usage is:

#gam info domain
Google Apps Domain: man.in
Customer ID: C3456%35uu
Default Language: en
Organization Name: The Man
Maximum Users: 50
Current Users: 16
Domain is Verified: true
Domain Edition: standard
Customer PIN: 1544667314
Domain Creation Time: 2010e35530443.482-0800
Domain Country Code: IN
MX Verification Verified: true
MX Verification Method: mx
SSO Signon Page:
SSO Logout Page:
SSO Password Page:
SSO Enabled: false
SSO Whitelist IPs:
SSO Use Domain Specific Issuer: false
User Migration Enabled: false
Outbound Gateway Smart Host: None
Outbound Gateway SMTP Mode: None

It is very useful.

Installation:
Download the python source code.
Now, unzip it on your web server into a suitable directory:

unzip gam-3.03-python-src.zip -d ~/gam

Now, you need to enable a few details in Google Apps.
First login to your Domain Admin Console at www.google.com/a/domain
Now, access the security tab and enable API access: Domain Console > Security > API Reference > API Access > Enable API access
Now create a project here, and give it a name.
Now Access the “APIs and Auth” tab.
Enable the following APIs: Admin SDK, Calendar API, Drive API, Drive SDK, Enterprise License Manager API and Groups Settings API (At least the ones in Bold).
Under API and Auth tab, click on Credentials tab.
Under Auth, “Create new client ID”
Under Application type, choose “Installed Application”
Under Installed Application type, choose “Other”
Click on “Create Client ID”
Under “Client ID for native application”, click on “Download JSON”
Open the downloaded file in any text editor (I prefer Notepad++ on Windows, geany/gedit/kate on Linux)

Now, ssh to your web server, enter the directory where you extracted the gam source code, and run:

touch nobrowser.txt
nano client_secrets.json

Paste the contents of the downloaded file, into client_secrets.json, save it.
Now, you’re ready to execute gam.py, either with:

./gam.py info domain

if it’s executable (recommended), or:

python gam.py info domain

Some useful commands:
Print email ids only:

gam print users

Print all user info:

gam print users allfields

Print email and First name:

gam print users firstname

Changing Domain Logo:
Create an image of 143 x 59 pixels or less, save it as a file of JPG, PNG or GIF file less than 20 KB.
Execute the following command:

gam update domain logo ~/eyrie_logo.jpg

That’s it!