Admin SDK Google Workspace 經銷商服務

透過 Admin SDK Google Workspace Reseller 服務,您可以在 Apps Script 中使用 Admin SDK Reseller API。授權的經銷商管理員可透過這項 API 下訂單,並管理 Google Workspace 月結後付方案訂閱。

參考資料

如要進一步瞭解這項服務,請參閱 Admin SDK Google Workspace Reseller API 的參考說明文件。與 Apps Script 中的所有進階服務一樣,Admin SDK Google Workspace Reseller 服務使用的物件、方法和參數,都與公開 API 相同。詳情請參閱「如何判斷方法簽章」。

如要回報問題及尋求其他支援,請參閱管理員 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);
}