Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Access the Directory API in Admin SDK

Trying in vain to access the Directory API in the Google Admin SDK (Reference). Upgrading the "google-api-python-client" package doesn't resolve it, as the Downloads > Installation > Python link instructs.

I also don't see in the documentation where it lists the programmatic name of the API, so I'm assuming it's "directory", but have also tried "directory.admin" and "admin.directory." I get the following exception when I try to run my test code:

apiclient.errors.UnknownApiNameOrVersion: name: directory  version: v1 

Could someone please assist with what I may be overlooking? Unfortunately, the "Quickstart" that provides the shell to access the API seems to be broken (Reference). When I select Python > Command-Line > Configure Project, I get an error that states "Sorry, unable to configure a project right now."

Here's the pertinent piece of code I'm using in my custom Directory library class:

class Directory(object):
    def __init__(self, httpConnection):
        self.service = build('directory', 'v1', http=httpConnection)

Is this just a case of no client library being available yet for the API? If so, when might that be available?

like image 339
Daniel Wren Avatar asked Jun 05 '13 15:06

Daniel Wren


People also ask

What is Admin SDK API?

The Admin SDK API is a RESTful API that can be used to programmatically create and manage admin-controlled resources owned by a Google Workspace account. Some use cases include: Creating and managing users and adding administrators.

What is directory API?

The Directory API is used to create and manage resources attached to your Google Workspace domain, such as users, org charts, and groups.

What is G Suite directory?

Google Workspace™ — formerly known as G Suite™ — answers user management with an internal directory and administrator console. IT admins can use the directory and console to manage their users' access, or expand their administrative capabilities with the Google Cloud Identity platform.


1 Answers

There's an issue where this new API isn't appearing in the list of supported APIs, but it is indeed there, you can access it from:

service = build('admin', 'directory_v1')
like image 145
Joe Gregorio Avatar answered Sep 20 '22 15:09

Joe Gregorio