This codelab guides you through the process of setting up a cloud project for making API calls. If you've already done that, skip ahead to the End-to-End Tutorial where you'll learn to create a fully functional G Suite customer.
Before you begin
To complete the codelab, you need the following:
- A Google Reseller domain instance
- A fully executed G Suite partner agreement
- A Google Cloud Project
Step 1: Prepare the Reseller console
Several terms and conditions bind the usage of the G Suite reseller platform. If these terms and conditions are not accepted, the API will return an HTTP 400 error with the relevant Terms of Service. You should review and potentially agree to all of the Terms of Service links below.
- Log in to the G Suite Reseller console at least once as a domain administrator to be prompted with the generic reseller terms of service.
- Accept the Google Drive Storage ToS.
- Accept the Google Vault ToS.
- Accept the Emerging Market Pricing ToS.
- Accept the Credit Card Invoicing ToS.
- Accept the Cloud Identity ToS.
Step 2: Download the Client Library
Using a Google client library is strongly suggested. You can download a client library for different languages.
Step 3: Configure the Google Cloud Console
In order to use any of Google's APIs, you must have an existing cloud project or create a new one.
Create Cloud Project
To create a project, navigate to the Projects area of your Google Cloud Console and click Create Project.
Give the project a descriptive name. The project ID is an arbitrary identifier that does not affect the customer provisioning process.
Navigate to the API Library section in the Google Cloud Console and enable the following APIs necessary for reselling G Suite:
- G Suite Reseller API
- Google Site Verification API
- Admin SDK
Create Service Account
After you've enabled the necessary APIs, set up your credentials in the form of a server-to-server service account. To create your service account, navigate to the Service Accounts area of your Google Cloud Console and select your current project.
ClickCreate Service Account, then follow the on-screen instructions. Make sure to do the following:
- Leave Role empty (skip this step).
- Click Create Key on the last step.
- Select Key Type JSON.
Once you click Create, a JSON private key will download. Save this file in a memorable location because it's a one-time download.
You've created a new service account! From the service account list, click theicon to the right of your service account, then Show Client ID. Take note of your service account's Client ID as you need it for the next section.
Step 4: Register the service account with the Reseller domain
Go to the Manage API client access area found in the Advanced Settings of your admin console's Security section.
In the Client Name box, enter the client ID of your service account that you created in the previous step. In the API Scopes box, enter the following scopes, separated by commas. This will authorize your service account to use the Admin SDK User resource, The Reseller API, and the Site Verification API.
https://www.googleapis.com/auth/apps.order, https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/siteverification,
Now, click Authorize.