บริการตัวแทนจำหน่าย Google Workspace สำหรับ Admin SDK

บริการ Admin SDK Google Workspace Reseller ช่วยให้คุณใช้ Admin SDK Reseller API ใน Apps Script ได้ API นี้ช่วยให้ผู้ดูแลระบบตัวแทนจำหน่ายที่ได้รับอนุญาตสามารถสั่งซื้อในนามของลูกค้า และจัดการการสมัครใช้บริการ Google Workspace แบบรายเดือนที่เรียกเก็บเงินภายหลัง ได้

ข้อมูลอ้างอิง

ดูข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ได้ในเอกสารอ้างอิงสำหรับ Admin SDK Google Workspace Reseller API เช่นเดียวกับบริการขั้นสูงทั้งหมดใน Apps Script บริการตัวแทนจำหน่าย Google Workspace ของ Admin SDK จะใช้ออบเจ็กต์ เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด

หากต้องการรายงานปัญหาและรับการสนับสนุนอื่นๆ โปรดดู คู่มือการสนับสนุนสำหรับตัวแทนจำหน่าย Admin SDK

โค้ดตัวอย่าง

ตัวอย่างโค้ดด้านล่างใช้ API เวอร์ชัน 1

รับรายการการสมัครใช้บริการ

ตัวอย่างนี้จะบันทึกรายการการสมัครใช้บริการ รวมถึงรหัสลูกค้า วันที่สร้าง ชื่อแพ็กเกจ และรหัส SKU โปรดสังเกตการใช้โทเค็นหน้าเว็บเพื่อเข้าถึงรายการผลลัพธ์ทั้งหมด

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);
}