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 Google Workspace customer.
Before you begin
To complete the codelab, you need the following:
- A Google Reseller domain instance
- A fully executed Google Workspace partner agreement
- A Google Cloud Project
Step 1: Prepare the Channel Services Console
Several terms and conditions bind the usage of the Google Workspace 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 Channel Services Console at least once as a domain administrator to be prompted with the generic reseller terms of service.
- Accept the Additional Product 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 Google Workspace:
- Google Workspace 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: Authorize the service account for the Reseller domain
Go to the Domain-wide delegation area found under API controls in your Admin console's Security section.
Click Add new, and in the Client ID box, enter the client ID of your service account that you created in the previous step. In the OAuth 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.