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 と同じオブジェクト、メソッド、パラメータを使用します。詳細については、メソッド シグネチャの決定方法をご覧ください。

問題を報告したり、その他のサポートを利用したりするには、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);
}