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

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

リファレンス

このサービスの詳細については、Admin SDK Google Workspace Reseller API のリファレンス ドキュメントをご覧ください。Apps Script のすべての高度なサービスと同様に、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);
}