Admin SDK Google Workspace 转销商服务

Admin SDK Google Workspace 经销商服务允许您在 Apps 脚本中使用 Admin SDK Reseller API。此 API 允许已获授权的转销商管理员下达客户订单,并管理 Google Workspace 按月后付费订阅。

参考

如需详细了解此服务,请参阅 Admin SDK Google Workspace Reseller API 的参考文档。与 Apps 脚本中的所有高级服务一样,Admin SDKGoogle Workspace Reseller 服务使用的对象、方法和参数均与公共 API 相同。如需了解详情,请参阅方法签名是如何确定的

如需报告问题并寻求其他支持,请参阅 Admin SDK 转销商支持指南

示例代码

以下示例代码使用 API 的版本 1

获取订阅列表

此示例会记录订阅列表,包括客户 ID、创建日期、方案名称和 SKU ID。 请注意,我们使用页面令牌来访问完整的结果列表。

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);
}