Admin SDK Google Workspace 販売パートナー サービス

Apps Script を使用して、顧客の注文と Google Workspace サブスクリプションを管理します。

Admin SDK Google Workspace Reseller サービスを使用すると、Google Apps Script で Admin SDK Reseller API を使用できます。この API を使用すると、正規販売パートナー管理者は顧客の注文を行い、Google Workspace の月額後払いサブスクリプションを管理できます。

これは、使用前に有効にする必要がある拡張サービスです。

リファレンス

このサービスの詳細については、Admin SDK Google Workspace Reseller API のリファレンス ドキュメントをご覧ください。Apps Script のすべての高度なサービスと同様に、Admin SDK Google Workspace 販売パートナー サービスでは、公開 API と同じオブジェクト、メソッド、パラメータを使用します。詳細については、メソッドのシグネチャの決定方法をご覧ください。

問題を報告したり、その他のサポートを利用したりするには、Admin SDK Reseller に関するサポートガイドをご覧ください。

サンプルコード

次のサンプルコードでは、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);
}