Admin SDK Google Workspace Reseller Service

The Admin SDK Google Workspace Reseller service allows you to use the Admin SDK Reseller API in Apps Script. This API allows authorized reseller admins to place customer orders and manage Google Workspace monthly post-pay subscriptions.

Reference

For detailed information on this service, see the reference documentation for the Admin SDK Google Workspace Reseller API. Like all advanced services in Apps Script, the Admin SDK Google Workspace Reseller service uses the same objects, methods, and parameters as the public API. For more information, see How method signatures are determined.

To report issues and find other support, see the Admin SDK Reseller support guide.

Sample code

The sample code below uses version 1 of the API.

Get a list of subscriptions

This sample logs the list of subscriptions, including the customer ID, date created, plan name, and the SKU ID. Notice the use of page tokens to access the full list of results.

advanced/adminSDK.gs
/**
 * Logs the list of subscriptions, including the customer ID, date created, plan
 * name, and the sku ID. Notice the use of page tokens to access the full list
 * of results.
 * @see https://developers.google.com/admin-sdk/reseller/reference/rest/v1/subscriptions/list
 */
function getSubscriptions() {
  let result;
  let pageToken;
  do {
    result = AdminReseller.Subscriptions.list({
      pageToken: pageToken
    });
    for (const sub of result.subscriptions) {
      const creationDate = new Date();
      creationDate.setUTCSeconds(sub.creationTime);
      console.log('customer ID: %s, date created: %s, plan name: %s, sku id: %s',
          sub.customerId, creationDate.toDateString(), sub.plan.planName,
          sub.skuId);
    }
    pageToken = result.nextPageToken;
  } while (pageToken);
}