1

We use Google Apps at my organization. I am trying to just use my API key (no oauth2) to get access to users info through the Directory API in the Admin SDK. I cannot find useful examples and the Google docs are buggy. I have had a great deal of difficulty with Google's API documentation. Or perhaps I have to use oauth2?

Even if I knew some of the details about this specific API, I can't find sample code for using these APIs in Python. Does anyone have sample code or links to real-world samples? I am new to Python and we're working on the App Engine.

tshepang
  • 12,111
  • 21
  • 91
  • 136
tomtom
  • 125
  • 2
  • 8

1 Answers1

3

You must use OAuth2 authentication, API key alone is not enough as you must authenticate as a Google Apps super admin or delegated admin (with appropriate rights) in order to perform Admin SDK Directory operations.

My project, Dito GAM was recently updated with full support for Admin SDK calls. It makes use of most (all?) Directory API calls. See:

https://code.google.com/p/google-apps-manager/source/browse/trunk/gam.py

Also, if you notice bugs or ambiguities in the Google documentation, be sure to report them. It won't get any better if someone doesn't tell them about it! Use the "Report a bug" link at the bottom of all developers.google.com pages. It's very simple to use and pinpoint the exact issue.

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
  • I reported 3 doc bugs so far. they have a good system for that. Thank you very much. I am checking the code now. – tomtom Jun 14 '13 at 14:53
  • What version of gdata is required? – tomtom Jun 14 '13 at 15:15
  • You should be using the Google API Python client with Admin SDK, not the old GData library: https://code.google.com/p/google-api-python-client/ – Jay Lee Jun 14 '13 at 15:35
  • Ok, that's what I have been using in other tests. I am still learning all this. I got an error "ImportError: No module named gdata.apps.emailsettings.service" off the bat so I'll keep fiddling. – tomtom Jun 14 '13 at 19:28
  • Sorry, I pointed you to the gam.py source assuming you just wanted to browse. If you're actually trying to run GAM, download it from https://code.google.com/p/google-apps-manager/downloads/list?q=label:gam3 and follow the instructions at: https://code.google.com/p/google-apps-manager/wiki/GAM3GettingStarted – Jay Lee Jun 14 '13 at 20:17
  • Hi @JayLee , I don't get it . "You must use OAuth2 authentication" for Google Admin Directory APi? I think 2Legged oauth1 should work on the Admin Directory API, with just the domain's consumer key and consumer secret, am I right? I am struggling to use 2LO on the Driectory API, but not succeed. – skyfree Jun 15 '13 at 09:51
  • @JayLee Does GAM allow setting Gmail signatures? I thought it does but browsing through the repo I couldn't find the code that implements this. Would you be able to share a link? – Janosh Mar 07 '21 at 15:42