เอกสารนี้จะอธิบายวิธีที่ผู้ดูแลระบบระดับบัญชีและตัวแทนจำหน่ายสามารถใช้ Enterprise License Manager API เพื่อจัดการการมอบหมายใบอนุญาตของผู้ใช้ เมื่อเปิดใช้ใบอนุญาต SKU ของผลิตภัณฑ์ของบัญชีและสร้างผู้ใช้แล้ว ให้ใช้ Enterprise License Manager API เพื่อมอบหมาย อัปเดต เรียกข้อมูล และลบใบอนุญาตสำหรับผู้ใช้ในบัญชีของคุณ
ในเวอร์ชันนี้ ผู้ดูแลระบบบัญชีและตัวแทนจำหน่ายจะใช้ Enterprise License Manager API ผู้ดูแลระบบที่ได้รับมอบสิทธิ์ซึ่งมีสิทธิ์ License Management
จะใช้ Enterprise License Manager API ได้ด้วย
หมายเหตุ: ลูกค้า Google ใช้ Enterprise License Manager API โปรดดูข้อมูลเกี่ยวกับวิธีที่นักพัฒนาแอปบุคคลที่สามของ Google จัดการใบอนุญาตที่ Google Workspace Marketplace API
Enterprise License Manager API สร้างขึ้นตามแนวทางการออกแบบ Reportingal State Transfer (RESTful) สำหรับบริการบนเว็บ
การจัดการใบอนุญาต
มอบหมายใบอนุญาต
ก่อนการดำเนินการนี้ ลูกค้าหรือตัวแทนจำหน่ายได้สั่งซื้อใบอนุญาตผลิตภัณฑ์ Google และสร้างผู้ใช้แล้ว หากต้องการมอบหมายใบอนุญาตผลิตภัณฑ์เหล่านี้ให้กับผู้ใช้รายนี้ ให้ใช้คำขอ HTTP POST
ต่อไปนี้ ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สำหรับผลิตภัณฑ์และ SKU โปรดดูผลิตภัณฑ์และ SKU ที่พร้อมให้บริการของ API:
POST https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user
หมายเหตุ: ผู้ใช้สามารถมอบหมายใบอนุญาตสำหรับผลิตภัณฑ์ต่างๆ ของ Google ได้มากมาย แต่ผู้ใช้ได้รับมอบหมายใบอนุญาต SKU เพียงครั้งละ 1 ใบต่อผลิตภัณฑ์ เมื่อใช้ API ระบบจะสามารถมอบหมายใบอนุญาต SKU ของผู้ใช้ใหม่ไปยังใบอนุญาต SKU อื่นภายในผลิตภัณฑ์
ตัวอย่างนี้จะกำหนด SKU ของ Google-Drive-storage-20GB ให้กับผู้ใช้ซึ่งมีอีเมลหลักเป็น alex@example.com ดังนี้
POST https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user
เนื้อหาของคำขอ JSON:
{ "userId" : "alex@example.com", }
การตอบกลับที่สำเร็จจะแสดง รหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API หากสำเร็จ การตอบกลับจะแสดงสถานะการกำหนดใบอนุญาตในรูปแบบข้อมูล JSON
การตอบกลับ JSON
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-20GB",
"skuName": "Google Drive storage 20 GB",
"productName": "Google Drive storage"
}
โปรดดูข้อมูลเพิ่มเติมในหน้าอ้างอิงแทรกเมธอด LicenseAssignments
เปลี่ยนการกำหนด SKU ของผลิตภัณฑ์ของผู้ใช้ที่มี SKU อื่นในผลิตภัณฑ์เดียวกัน
หากต้องการมอบหมายใบอนุญาตของผู้ใช้ใหม่ให้กับ SKU ใบอนุญาตใหม่ภายในผลิตภัณฑ์เดียวกัน ให้ใช้คำขอ HTTP PUT
ต่อไปนี้ นอกจากนี้ API ยังรองรับไวยากรณ์แพตช์ด้วย ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สำหรับผลิตภัณฑ์และ SKU โปรดดูผลิตภัณฑ์และ SKU ที่พร้อมให้บริการของ API:
PUT https://www.googleapis.com/apps/licensing/v1/product/productId/sku/the current skuId/user/user's email
ตัวอย่างนี้จะอัปเดต SKU ปัจจุบันของ Google-Drive-storage-20GB เป็น Google-Drive-storage-50GB SKU ของใบอนุญาตที่มีอยู่จะอยู่ใน URI ของคำขอ และ SKU ใบอนุญาตใหม่จะอยู่ในเนื้อหาของคำขอ ดังนี้
PUT https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-20GB/user/alex@example.com
เนื้อหาคำขอ JSON มี :
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
การตอบกลับที่สำเร็จจะแสดง รหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API หากสำเร็จ การตอบกลับจะแสดงสถานะการมอบหมายใบอนุญาตในรูปแบบข้อมูล JSON
การตอบกลับ JSON
{
"kind": "licensing#licenseAssignment",
"etags": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "alex@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
ดูข้อมูลเพิ่มเติมได้ที่หน้าวิธีการอัปเดตและวิธีแพตช์ของ LicenseAssignments
ดึงข้อมูลใบอนุญาตทั้งหมดที่ได้รับมอบหมายใบอนุญาตสำหรับผลิตภัณฑ์ที่เฉพาะเจาะจง
หากต้องการได้รับใบอนุญาตทั้งหมดสำหรับผู้ใช้สำหรับผลิตภัณฑ์ที่เฉพาะเจาะจง ให้ใช้คำขอ HTTP GET
ต่อไปนี้ ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สตริงการค้นหา customerId
คือชื่อโดเมนหลักของลูกค้า สตริงคำค้นหา maxResults
จะกำหนดจำนวนรายการใบอนุญาตของผู้ใช้ที่จะแสดงในการตอบกลับของ API ดังนี้
GET https://www.googleapis.com/apps/licensing/v1/product/productId/users?customerId=primary domain name&maxResults=max results per page
สำหรับรหัสผลิตภัณฑ์และรหัส SKU โปรดดูผลิตภัณฑ์และ SKU ที่ API พร้อมใช้งาน
ตัวอย่างนี้แสดงหน้าแรกของผลการค้นหาสำหรับผู้ใช้ทุกคนในโดเมน example.com ที่ได้รับมอบหมายใบอนุญาตสำหรับผลิตภัณฑ์พื้นที่เก็บข้อมูล Google ไดรฟ์ ดังนี้
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/users?customerId=example.com&maxResults=2
การตอบกลับที่สำเร็จจะแสดง รหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API หากสำเร็จ การตอบสนองจะแสดงรายการการอนุญาตให้ใช้สิทธิในรูปแบบ JSON
การตอบกลับ JSON
{ "kind" : "licensing#licenseAssignmentList", "etag": "etag value", "nextPageToken" : "the next page token value", "items": [ { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com", "userId": "alex@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-50GB", "skuName": "Google Drive storage 50 GB", "productName": "Google Drive storage" }, { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/keshav@example.com", "userId": "keshav@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, ... }
โปรดดูข้อมูลเพิ่มเติมในหน้าข้อมูลอ้างอิงเมธอดlistForProductของ LicenseAssignments
ดึงข้อมูลผู้ใช้ที่ได้รับมอบหมายใบอนุญาตทั้งหมดสำหรับ SKU ของผลิตภัณฑ์ที่เฉพาะเจาะจง
หากต้องการดูรายชื่อผู้ใช้ทั้งหมดที่มีใบอนุญาตสำหรับ SKU ของผลิตภัณฑ์ที่เฉพาะเจาะจง ให้ใช้คำขอ HTTP GET
ต่อไปนี้ ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สตริงการค้นหา customerId
คือชื่อโดเมนหลักของลูกค้า สตริงคำค้นหา maxResults
จะกำหนดจำนวนรายการผู้ใช้ที่แสดงในการตอบกลับของ API ดังนี้
GET https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/users?customerId=primary domain name&maxResults=max results per response page
สำหรับผลิตภัณฑ์และรหัส SKU โปรดดูผลิตภัณฑ์และ SKU ที่ API พร้อมใช้งาน
ตัวอย่างนี้แสดงหน้าแรกของผู้ใช้ทุกคนในโดเมน example.com ที่ได้รับมอบหมายใบอนุญาตสำหรับ SKU ของ Google-Drive-storage-200GB คำตอบจะแสดงรายชื่อผู้ใช้ 2 รายการต่อหน้า ดังนี้
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/users?customerId=example.com&maxResults=2
การตอบกลับที่สำเร็จจะแสดง รหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API หากสำเร็จ การตอบกลับจะแสดงรายการการอนุญาตให้ใช้สิทธิในรูปแบบ JSON
การตอบกลับ JSON
{ "kind" : "licensing#licenseAssignmentList", "etag": "etag value", "nextPageToken" : "next page token's value", "items": [ { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/alex@example.com", "userId": "alex@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, { "kind": "licensing#licenseAssignment", "etags": "etag value", "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-200GB/user/mary@example.com", "userId": "mary@example.com", "productId": "Google-Drive-storage", "skuId": "Google-Drive-storage-200GB", "skuName": "Google Drive storage 200 GB", "productName": "Google Drive storage" }, ... }
โปรดดูข้อมูลเพิ่มเติมในหน้าข้อมูลอ้างอิงเมธอดlistForProductAndSku ของ LicenseAssignments
ดึงข้อมูลใบอนุญาตของผู้ใช้ที่เฉพาะเจาะจงตาม SKU ของผลิตภัณฑ์
หากต้องการซื้อใบอนุญาตของผู้ใช้ที่เฉพาะเจาะจงตาม SKU ของผลิตภัณฑ์ ให้ใช้คำขอ HTTP GET
ต่อไปนี้ ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สำหรับผลิตภัณฑ์และ SKU โปรดดูผลิตภัณฑ์และ SKU ที่พร้อมให้บริการของ API:
GET https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user/userId
ตัวอย่างนี้จะได้รับ SKU ผลิตภัณฑ์พื้นที่เก็บข้อมูล Google ไดรฟ์ 50 GB สำหรับผู้ใช้ที่มี userId
เป็น alex@example.com:
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com
หากผู้ใช้มีใบอนุญาตนี้ แสดงว่าระบบตอบกลับสำเร็จและรหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API หากสำเร็จ การตอบกลับจะแสดงใบอนุญาตของผู้ใช้ในรูปแบบ JSON
การตอบกลับ JSON
{
"kind": "licensing#licenseAssignment",
"etag": "etag value",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com",
"userId": "keshav@example.com",
"productId": "Google-Drive-storage",
"skuId": "Google-Drive-storage-50GB",
"skuName": "Google Drive storage 50 GB",
"productName": "Google Drive storage"
}
โปรดดูข้อมูลเพิ่มเติมในหน้าข้อมูลอ้างอิงวิธีการรับ LicenseAssignments
ลบใบอนุญาต
หากต้องการยกเลิกมอบหมายใบอนุญาตจากผู้ใช้ ให้ใช้คำขอ HTTP DELETE
ต่อไปนี้ ให้ใส่ส่วนหัว Authorization
ตามที่อธิบายไว้ในการให้สิทธิ์คำขอ สำหรับผลิตภัณฑ์และ SKU โปรดดูผลิตภัณฑ์และ SKU ที่พร้อมให้บริการของ API:
DELETE https://www.googleapis.com/apps/licensing/v1/product/productId/sku/skuId/user/userId
ตัวอย่างนี้มีการยกเลิกการมอบหมายใบอนุญาต Google-Drive-storage-50GB จากผู้ใช้ที่มี userId
คือ alex@example.com
DELETE https://www.googleapis.com/apps/licensing/v1/product/Google-Drive-storage/sku/Google-Drive-storage-50GB/user/alex@example.com
การตอบกลับที่สำเร็จจะแสดง รหัสสถานะ HTTP 200
สำหรับรหัสข้อผิดพลาดที่อาจเกิดขึ้นได้ที่หัวข้อรหัสข้อผิดพลาดของ API
โปรดดูข้อมูลเพิ่มเติมในหน้าข้อมูลอ้างอิงวิธีการลบ LicenseAssignments
รหัสข้อผิดพลาด
หากคำขอไม่สำเร็จ การตอบกลับจะมีคำอธิบายข้อผิดพลาดสั้นๆ ดังนี้
รหัสข้อผิดพลาด | คำอธิบาย |
---|---|
400 | คำขอไม่ถูกต้อง - อีเมลของผู้ใช้ไม่ถูกต้อง |
400 | คำขอไม่ถูกต้อง - ไม่มี SKU/ผลิตภัณฑ์ |
401 | ผู้ดำเนินการไม่มีข้อมูลเข้าสู่ระบบในการเรียกใช้ API นี้ |
404 | ถ้าผู้ใช้ไม่มีใบอนุญาตนี้ การตอบกลับจะมีรหัสข้อผิดพลาด "ไม่พบ" |
412 | ไม่ตรงตามเงื่อนไขที่กำหนดไว้ล่วงหน้า โปรดดูรายละเอียดเกี่ยวกับข้อผิดพลาดนี้ในช่อง message เช่น
|
503 | บริการเครื่องมือจัดการใบอนุญาตไม่สามารถใช้งานได้ |