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

ใน Apps Script เพื่อจัดการคำสั่งซื้อของลูกค้าและการสมัครใช้บริการ Google Workspace

บริการ Admin SDK Google Workspace Reseller ช่วยให้คุณใช้ Admin SDK Reseller API ใน Google 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);
}