Admin SDK G Suite Reseller Service

The Admin SDK G Suite 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 G Suite monthly post-pay subscriptions.

Reference

For detailed information on this service, see the reference documentation for the Admin SDK G Suite Reseller API. Like all advanced services in Apps Script, the Admin SDK G Suite Reseller service uses the same objects, methods, and parameters as the public API.

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.
 */
function getSubscriptions() {
  var result;
  var subscriptions;
  var pageToken;
  do {
    result = AdminReseller.Subscriptions.list({
      pageToken: pageToken
    });
    for (var i = 0; i < result.subscriptions.length; i++) {
      var sub = result.subscriptions[i];
      var creationDate = new Date();
      creationDate.setUTCSeconds(sub.creationTime);
      Logger.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);
}

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.