Events, Programming, Python

Google Directory API

Google’s Admin SDK developer webpages are very confusing…

Google Groups API & Directory API Requirements:

Apparently to use any API, you must be using google apps for Business, Education, or Non-Profit. There must also be a valid domain name under that account. Having a group ending with “@googlegroups.com” will give you errors.

BEFORE YOU START PROGRAMMING:

Make sure that you can demo the process, in the ‘try it’ section of most of the (not very helpful) ‘reference’ pages (ex. HERE)

THEN PROGRAMMING:

My suggestion is python, mainly because there is already an API that you can find and download easily. (Eclipse has a great plugin)

PythonDirectoryAPISC (My have some weird characters in it, has something to do with tabbing, just delete them if you see them)

Other Maybe helpful Tips:

Auth2.0

Need client_secrets.json (From Google Apis Console)

Set Scopes (** It’s for python  and only for directory API**)

service = build(‘admin’, ‘directory_v1’, http=http)

Import statements matter

Here is my preliminary source code:

PythonDirectoryAPISC

To access the real (very helpful) directory API reference (like what functions and correct spelling etc.), the file is:

https://developers.google.com/resources/api-libraries/documentation/admin/directory_v1/python/latest/admin_directory_v1.members.html#insert

https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members#create_member

(This took a ridiculous long time to find, since google just kept on redirecting me to the same webpages, and I kept on getting errors)

Comment if you have questions and I’ll try to help!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.