ตัวอย่างโค้ดสำหรับ Chrome Management Chrome Browsers API

ไปที่ Chrome Management Chrome Browsers API เพื่อดูภาพรวมของฟีเจอร์ API

คำขอทั้งหมดที่แสดงในหน้านี้ใช้ตัวแปรต่อไปนี้

  • $TOKEN - โทเค็น OAuth 2.0
  • $CUSTOMER - รหัสของลูกค้าหรือข้อความ my_customer

แสดงรายการเบราว์เซอร์ Chrome ที่ลงทะเบียนไว้

หากต้องการแสดงเบราว์เซอร์ Chrome ที่ลงทะเบียน ให้ใช้ปลายทาง /chromeBrowsers คุณสามารถ ควบคุมการแบ่งหน้าได้โดยใช้พารามิเตอร์ pageSize (สูงสุดและค่าเริ่มต้นคือ 100) และ pageToken ใช้ orderBy เพื่อระบุลำดับของผลลัพธ์ ระบุ filter เพื่อจำกัดผลลัพธ์ให้แคบลง คุณระบุมาสก์การอ่านได้ด้วยfieldsพารามิเตอร์การค้นหา

ระบบรองรับการจับคู่ไวลด์การ์ด (*) (คำนำหน้า prefix*, คำต่อท้าย *suffix, สตริงย่อย *substring* หรือการมีอยู่ *) กับ = และ : เฉพาะในช่อง machine_name, annotated_asset_id และ browser_version

การค้นหาข้อความทั่วโลก (โดยไม่ต้องระบุชื่อฟิลด์) จะค้นหาในฟิลด์ข้อความที่จัดทำดัชนีทั้งหมด เมื่อคั่นคำหลายคำด้วย AND หรือช่องว่าง (เช่น filter=machine AND 73 หรือ filter=machine 73) ทุกคำจะต้องตรงกับ ฟิลด์ข้อความที่จัดทำดัชนีอย่างน้อย 1 รายการในอุปกรณ์เบราว์เซอร์ (แม้จะอยู่ในฟิลด์ที่แตกต่างกัน) การใส่คำหลายคำในสตริงที่อยู่ในเครื่องหมายคำพูดเดียว (เช่น filter="machine name") จะค้นหาวลีที่ต่อเนื่องกันนั้นใน ช่องเดียว

ตัวอย่างคำค้นหาตัวกรอง

# Filter by machine name prefix (using ':' or '=')
filter=machine_name:LIX*

# Filter by annotated asset ID suffix
filter=annotated_asset_id="*1001"

# Filter by browser version substring
filter=browser_version:"*6367*"

# Global search across all indexed text fields (matches browsers containing both "machine" and "73" across any fields)
filter=machine AND 73

# Global search with implicit AND (equivalent to `machine AND 73`)
filter=machine 73

# Filter by machine name prefix and registration time range
filter=machine_name:LIX* AND last_registration_time>=2024-01-01T00:00:00Z

# Filter by Organizational Unit path
filter=org_unit_path=/Marketing

ส่งคำขอ

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers?pageSize=2&orderBy=lastActivityTime+desc&filter=os_platform=WINDOWS"

คำตอบ

{
  "chromeBrowsers": [
    {
      "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
      "browserPermanentId": "<browserPermanentId1>",
      "machineName": "CLIENT2024-01",
      "osPlatformType": "WINDOWS",
      "osVersion": "10.0.19045",
      "browserVersion": "124.0.6367.60",
      "annotatedUser": "user1@example.com",
      "annotatedLocation": "US-NYC",
      "annotatedAssetId": "ASSET-1001",
      "annotatedNotes": "Engineering workstation",
      "lastActivityTime": "2024-04-23T22:05:44.214362Z",
      "lastPolicySyncTime": "2024-04-23T22:00:00.000Z",
      "lastStatusReportTime": "2024-04-23T22:05:44.214362Z",
      "enrollmentDate": "2024-01-15T10:30:00.000Z",
      "orgUnitPath": "/Engineering",
      "policyCount": 15,
      "extensionCount": 8
    },
    {
      "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId2>",
      "browserPermanentId": "<browserPermanentId2>",
      "machineName": "CLIENT2024-02",
      "osPlatformType": "WINDOWS",
      "osVersion": "11.0.22631",
      "browserVersion": "124.0.6367.60",
      "annotatedUser": "user2@example.com",
      "annotatedLocation": "US-MTV",
      "lastActivityTime": "2024-04-23T21:45:10.102000Z",
      "lastPolicySyncTime": "2024-04-23T21:40:00.000Z",
      "lastStatusReportTime": "2024-04-23T21:45:10.102000Z",
      "enrollmentDate": "2024-02-10T14:15:00.000Z",
      "orgUnitPath": "/Engineering",
      "policyCount": 12,
      "extensionCount": 5
    }
  ],
  "nextPageToken": "<nextPageToken>"
}

ดึงข้อมูลเบราว์เซอร์ Chrome ที่มีการจัดการ

หากต้องการดึงข้อมูลเบราว์เซอร์ Chrome ที่ลงทะเบียนรายการเดียว ให้ใช้ปลายทาง /chromeBrowsers/{browser_permanent_id} คุณระบุมาสก์การอ่านได้ ด้วยพารามิเตอร์ fields

ส่งคำขอ

  curl -X GET \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>"

คำตอบ

{
  "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
  "browserPermanentId": "<browserPermanentId1>",
  "machineName": "CLIENT2024-01",
  "osPlatformType": "WINDOWS",
  "osVersion": "10.0.19045",
  "browserVersion": "124.0.6367.60",
  "annotatedUser": "user1@example.com",
  "annotatedLocation": "US-NYC",
  "annotatedAssetId": "ASSET-1001",
  "annotatedNotes": "Engineering workstation",
  "lastActivityTime": "2024-04-23T22:05:44.214362Z",
  "lastPolicySyncTime": "2024-04-23T22:00:00.000Z",
  "lastStatusReportTime": "2024-04-23T22:05:44.214362Z",
  "enrollmentDate": "2024-01-15T10:30:00.000Z",
  "orgUnitPath": "/Engineering",
  "policyCount": 15,
  "extensionCount": 8
}

อัปเดตข้อมูลคำอธิบายประกอบสำหรับเบราว์เซอร์ Chrome

หากต้องการอัปเดตช่องที่มีคำอธิบายประกอบของเบราว์เซอร์ Chrome ที่ลงทะเบียนไว้ ให้ใช้/chromeBrowsers/{browser_permanent_id}ปลายทางด้วยเมธอด HTTP PATCH และระบุพารามิเตอร์การค้นหา updateMask ที่ระบุช่องที่จะอัปเดต

ส่งคำขอ

  curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>?updateMask=annotatedUser,annotatedNotes" \
  -d '{
    "annotatedUser": "newuser@example.com",
    "annotatedNotes": "Updated primary workstation"
  }'

คำตอบ

{
  "name": "customers/<customerId>/chromeBrowsers/<browserPermanentId1>",
  "browserPermanentId": "<browserPermanentId1>",
  "machineName": "CLIENT2024-01",
  "osPlatformType": "WINDOWS",
  "osVersion": "10.0.19045",
  "browserVersion": "124.0.6367.60",
  "annotatedUser": "newuser@example.com",
  "annotatedLocation": "US-NYC",
  "annotatedAssetId": "ASSET-1001",
  "annotatedNotes": "Updated primary workstation",
  "lastActivityTime": "2024-04-23T22:05:44.214362Z",
  "orgUnitPath": "/Engineering"
}

ย้ายเบราว์เซอร์ Chrome ไปยังหน่วยขององค์กรใหม่

หากต้องการย้ายเบราว์เซอร์ Chrome ที่มีการจัดการจากหน่วยขององค์กรหนึ่งไปยังอีกหน่วยหนึ่ง ให้ใช้/chromeBrowsers:move ย้ายเบราว์เซอร์ได้สูงสุด 600 รายการต่อคำขอ หาก เกิดข้อผิดพลาดในการย้ายเบราว์เซอร์ใดก็ตาม ระบบจะไม่ย้ายเบราว์เซอร์ที่ระบุ

ส่งคำขอ

  curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers:move" \
  -d '{
    "destinationOrgUnitId": "03ph8a2z3v",
    "resourceIds": [
      "customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>",
      "customers/$CUSTOMER/chromeBrowsers/<browserPermanentId2>"
    ]
  }'

คำตอบ

{}

ลบข้อมูลที่รวบรวมจากเบราว์เซอร์ Chrome

หากต้องการลบข้อมูลที่รวบรวมจากเบราว์เซอร์ Chrome ที่มีการจัดการ ให้ใช้ปลายทาง /chromeBrowsers/{browser_permanent_id} กับ HTTP DELETE

ส่งคำขอ

  curl -X DELETE \
  -H "Authorization: Bearer $TOKEN" \
  "https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/chromeBrowsers/<browserPermanentId1>"

คำตอบ

{}