ไปที่ API โทเค็นการลงทะเบียนการจัดการของ Chrome เพื่อดูภาพรวมของฟีเจอร์ API
คำขอทั้งหมดที่แสดงในหน้านี้ใช้ตัวแปรต่อไปนี้
$TOKEN- โทเค็น OAuth 2.0$CUSTOMER- รหัสของลูกค้าหรือข้อความmy_customer
สร้างโทเค็นการลงทะเบียน
หากต้องการสร้างโทเค็นการลงทะเบียนใหม่สำหรับอุปกรณ์เบราว์เซอร์ ให้ใช้ปลายทาง /enrollmentTokens กับ HTTP POST คุณเลือกที่จะระบุ
enrollmentTokenIdพารามิเตอร์การค้นหาเพื่อกำหนดรหัสโทเค็นที่กำหนดเองได้
ส่งคำขอ
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens" \
-d '{
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER",
"orgUnitId": "03ph8a2z3v"
}'
คำตอบ
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
ดึงข้อมูลโทเค็นการลงทะเบียน
หากต้องการดึงโทเค็นการลงทะเบียนรายการเดียว ให้ใช้ปลายทาง /enrollmentTokens/{token_permanent_id} กับ HTTP GET
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>"
คำตอบ
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
แสดงรายการโทเค็นการลงทะเบียน
หากต้องการแสดงโทเค็นการลงทะเบียน ให้ใช้ปลายทาง /enrollmentTokens กับ HTTP GET
คุณสามารถควบคุมการแบ่งหน้าได้โดยใช้พารามิเตอร์ pageSize (สูงสุดและค่าเริ่มต้นคือ 100) และ
pageToken ระบุ filter เพื่อจำกัดผลลัพธ์ให้แคบลง
ตัวอย่างคำค้นหาตัวกรอง
# Filter by token state
filter=token_state=ACTIVE
# Filter by Organizational Unit path
filter=org_unit_path=/Marketing
# Filter by Organizational Unit path containing spaces
filter=org_unit_path='/Browser Management'
# Filter by Organizational Unit ID
filter=org_unit_id=03ph8a2z3v
# Filter by token state, Organizational Unit path, and device type
filter=token_state=ACTIVE AND org_unit_path=/Marketing AND device_type=CHROME_BROWSER
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens?pageSize=2&filter=token_state=ACTIVE"
คำตอบ
{
"enrollmentTokens": [
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId1>",
"tokenPermanentId": "<tokenPermanentId1>",
"token": "<tokenValue1>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T22:00:00.000Z",
"creatorId": "user1@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
},
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId2>",
"tokenPermanentId": "<tokenPermanentId2>",
"token": "<tokenValue2>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_ACTIVE",
"createTime": "2024-04-23T21:30:00.000Z",
"creatorId": "user2@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}
],
"nextPageToken": "<nextPageToken>"
}
เพิกถอนโทเค็นการลงทะเบียน
หากต้องการเพิกถอนโทเค็นการลงทะเบียน ให้ใช้ปลายทาง /enrollmentTokens/{token_permanent_id}:revoke กับ HTTP POST
ส่งคำขอ
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/enrollmentTokens/<tokenPermanentId>:revoke" \
-d '{}'
คำตอบ
{
"name": "customers/<customerId>/enrollmentTokens/<tokenPermanentId>",
"tokenPermanentId": "<tokenPermanentId>",
"token": "<tokenValue>",
"customerId": "<customerId>",
"orgUnitId": "03ph8a2z3v",
"state": "ENROLLMENT_TOKEN_STATE_REVOKED",
"createTime": "2024-04-23T22:00:00.000Z",
"revokeTime": "2024-04-24T10:15:00.000Z",
"creatorId": "user@example.com",
"revokerId": "admin@example.com",
"tokenType": "ENROLLMENT_TOKEN_TYPE_CHROME_BROWSER"
}