System requirements

Step 1: Enable domain-wide delegation of authority

Create the service account and its credentials

You must first create a service account. During this procedure the following
credentials will be generated that your application will need the client ID, the
private key, and the email address of the service account.

The following steps create a Google API Console project with credentials for
a service account. The procedure generates credentials that your
application will need: the client ID, the private key, and the
email address of the service account.

In the list of Google APIs, search for the Google+ Domains API service.

Select Google+ Domains API from the results list.

Select Enable API.

When the process completes, Google+ Domains API appears in the list of enabled APIs.
To access, select APIs & Services on the left sidebar menu, then select the
Enabled APIs tab.

In the sidebar under "APIs & Services", select Credentials, then select
the OAuth consent screen tab.

Choose an Email Address, specify a Product Name, and
select Save.

From the Credentials tab, select the New credentials drop-down list,
and choose Service account key.

In the Service account drop-down, choose New service account.

Enter a Name. The Service account ID is generated for you from
the name you enter. You can accept this ID or override it. The Service account ID must
be between 6 and 30 characters.

Choose a Key type, then select the Create button.

Once generated, the public/private key pair file downloads to your machine.
The file serves as the only copy of this key; you are responsible for storing it
securely.

A "Service account created" dialog pops-up after successful creation/download.
Select Close to return to the Credentials page.

The Credentials page now displays a Service account keys
section containing the service account ID,
Creation date, and Service account name.
To view the service account's Email address,
select Manage service accounts to access the Permissions page.
Note or copy these values to use in later steps to configure access to the API.

Delegate domain-wide authority to your service account

The service account must now be granted access to the user data for your Google
Apps domain. The following tasks must be performed by an administrator of the
Google Apps domain:

Open your G Suite domain control panel, at
https://www.google.com/a/cpanel/example.com.

Click on the Security icon. This can
sometimes be found in the More controls
option.

The application will request access to your domain's user data using domain-wide
delegation for the user account specified by USER_EMAIL. The application then
uses the Java client library to create a new activity that
will appear on the user's profile, shared with the domain.

Next steps

Now that you have learned to create a Google API Console project and run a
sample app, you can learn more about the Google+ Domains API features you can
add to your app: