Admin SDK Reseller Service

The Admin SDK 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 Reseller API. Like all advanced services in Apps Script, the Admin SDK Reseller service uses the same objects, methods, and parameters as the public API.

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.

function getSubscriptions() {
  var result, subscriptions, 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);
}

发送以下问题的反馈:

此网页
Apps Script
Apps Script