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 转销商服务使用的对象、方法和参数与公共 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);
}