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 follow the code lab, you will need:
- 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
Step 2: Download the Client Library
Using a Google client library is strongly suggested. Download a library for your language here.
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, name your service account, and make sure to:
- Leave Role empty
Furnish a new private key
- Select Key Type
- Select Key Type
- Select Enable G Suite Domain-wide Delegation
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 select View Client ID and take note of your service account's Client ID and Email Address. You will need the Client ID for the next section and the Email Address when making API calls.
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.