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

Admin SDK 販売店サービスを使用すると、Apps Script で Admin SDK 販売店 API を使用できます。この API を使用すると、承認済みの販売パートナー管理者は、顧客の注文を行い、 月単位の請求制サブスクリプションを管理できます。

リファレンス

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