ตัวอย่างโค้ดสำหรับ API รายละเอียดแอปการจัดการ Chrome / ส่วนขยาย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ไปที่เว็บไซต์
API รายละเอียดแอปการจัดการของ Chrome
เพื่อดูภาพรวมฟีเจอร์ของ API
คำขอทั้งหมดที่แสดงด้านล่างใช้ตัวแปรต่อไปนี้
$TOKEN
- โทเค็น OAuth 2
$CUSTOMER
- รหัสของลูกค้าหรือรหัสของลูกค้า my_customer
ดูรายละเอียดสำหรับแอป / ส่วนขยาย Chrome
หากต้องการดูรายละเอียดเกี่ยวกับแอป Chrome ที่ต้องการ ให้ใช้
อุปกรณ์ปลายทาง /apps/chrome/{app_id}@{app_version}
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef@1.2.3"
คำตอบ
{
"name": "customers/<customer>/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef@1.2.3",
"displayName": "Sample Google Chrome Extension",
"description": "A sample Google Chrome extension.",
"revisionId": "1.2.3",
"type": "CHROME",
"iconUri": "https://sample.chrome.extension.google.com/icon.png",
"detailUri": "https://chrome.google.com/webstore/detail/abcdefghijklmnopqrstuvwxyzabcdef",
"firstPublishTime": "2010-10-10T10:10:10.123456Z",
"latestPublishTime": "2020-10-10T10:10:10.123456Z",
"publisher": "sample.com",
"homepageUri": "http://sample.chrome.extension.google.com/home",
"reviewNumber": "10000",
"reviewRating": 4.5,
"chromeAppInfo": {
"supportEnabled": false,
"minUserCount": 6000000,
"permissions": [
{
"type": "content_security_policy",
"documentationUri": "https://developer.chrome.com/extensions/contentSecurityPolicy",
"accessUserData": false
},
{
"type": "contextmenus",
"documentationUri": "https://developer.chrome.com/extensions/contextMenus",
"accessUserData": false
},
],
"siteAccess": [
{
"hostMatch": "<all_urls>"
}
],
"isTheme": false,
"googleOwned": true,
"isCwsHosted": true
}
}
ดูรายละเอียดสำหรับแอป Android
หากต้องการดูรายละเอียดเกี่ยวกับแอป Android ที่เจาะจง ให้ใช้
อุปกรณ์ปลายทาง /apps/android/{app_id}@{app_version}
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/android/com.google.android.sample@1.2.3"
คำตอบ
{
"name": "customers/<customer>/apps/android/com.google.android.sample@1.2.3",
"displayName": "Sample Android App",
"description": "A sample Android app.",
"appId": "com.google.android.sample",
"revisionId": "1.2.3",
"type": "ANDROID",
"iconUri": "https://sample.android.app.google.com/icon.png",
"detailUri": "https://play.google.com/store/apps/details?id=com.google.android.sample",
"firstPublishTime": "2010-10-10T10:10:10.123456Z",
"latestPublishTime": "2020-10-10T10:10:10.123456Z",
"publisher": "Google LLC",
"isPaidApp": true,
"homepageUri": "http://sample.android.app.google.com/home",
"privacyPolicyUri": "http://sample.android.app.google.com/privacy",
"reviewNumber": "10000",
"reviewRating": 4.5,
"androidAppInfo": {
"permissions": [
{
"type": "android.permission.CAMERA"
},
]
}
}
ดูรายละเอียดสำหรับ Progressive Web App
หากต้องการดูรายละเอียดเกี่ยวกับเว็บแอป Prgoressive ที่เจาะจง ให้ใช้
อุปกรณ์ปลายทาง /apps/web/{app_id}
โปรดทราบว่ารหัสแอปคือหน้าแรกของแอปที่เข้ารหัส URL
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/web/http%3A%2F%2Fsample.web.app.google.com%2F"
คำตอบ
{
"name": "customers/<customer>/apps/web/http%3A%2F%sample.web.app.google.com%2F",
"displayName": "sample.web.app.google.com",
"description": "A sample Progressive Web App.",
"appId": "http://sample.web.app.google.com/",
"type": "WEB",
"iconUri": "http://sample.web.app.google.com/icon.png"
}
แสดงรายการส่วนขยาย Chrome ที่ขอ
หากต้องการแสดงรายการแอป Chrome ที่ขอ ให้ใช้
อุปกรณ์ปลายทาง /apps:countChromeAppRequests
ส่งคำขอ
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps:countChromeAppRequests"
คำตอบ
{
"requestedApps": [
{
"appId": "abcdefghijklmnopqrstuvwxyzabcdef",
"displayName": "Sample Google Chrome Extension",
"appDetails": "customers/<customer>/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef",
"iconUri": "https://sample.chrome.extension.google.com/icon.png",
"detailUri": "https://chrome.google.com/webstore/detail/abcdefghijklmnopqrstuvwxyzabcdef",
"requestCount": "1",
"latestRequestTime": "2020-10-10T10:10:10.123456Z"
},
],
"totalSize": 1
}
ดำเนินการกับคำขอส่วนขยาย
หากต้องการดำเนินการที่เหมาะสมกับคำขอของแอปจากผู้ใช้ปลายทาง คุณจะต้องใช้ Chrome Policy API ทำตามคู่มือการตั้งค่าเพื่อเข้าถึง API จากนั้นคุณจะส่งคำขอไปยัง API ดังกล่าวเพื่อดำเนินการต่างๆ ได้ ดูตัวอย่างสำหรับการส่งคำขอที่เกี่ยวข้องกับแอปได้ที่นี่ ต่อไปนี้เป็นตัวอย่างการดำเนินการทั่วไปที่คุณทำได้กับคำขอแอป
อนุมัติคำขอส่วนขยายที่ผู้ใช้/อุปกรณ์ภายใต้ OU ติดตั้งด้วยตนเอง
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:abcdefghijklmnopqrstuvwxyzabcdef"}
},
policyValue: {
policySchema: "chrome.users.apps.InstallType",
value: {appInstallType: "ALLOWED"}
},
updateMask: {paths: "appInstallType"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
การตอบกลับที่สำเร็จควรว่างเปล่า:
{}
ปฏิเสธคำขอส่วนขยายสำหรับผู้ใช้/อุปกรณ์ทั้งหมดภายใต้ OU
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:abcdefghijklmnopqrstuvwxyzabcdef"}
},
policyValue: {
policySchema: "chrome.users.apps.InstallType",
value: {appInstallType: "BLOCKED"}
},
updateMask: {paths: "appInstallType"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
การตอบกลับที่สำเร็จควรว่างเปล่า:
{}
บังคับติดตั้งส่วนขยายสำหรับผู้ใช้/อุปกรณ์ทั้งหมดภายใต้ OU
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:abcdefghijklmnopqrstuvwxyzabcdef"}
},
policyValue: {
policySchema: "chrome.users.apps.InstallType",
value: {appInstallType: "FORCED"}
},
updateMask: {paths: "appInstallType"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
การตอบกลับที่สำเร็จควรว่างเปล่า:
{}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis documentation outlines how to use the Chrome Management APIs to retrieve details for Chrome apps, Android apps, and Progressive Web Apps.\u003c/p\u003e\n"],["\u003cp\u003eYou can fetch app details like name, description, permissions, and publisher information using specific endpoints and an OAuth 2 token.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation also explains how to list requested Chrome extensions and their associated request counts.\u003c/p\u003e\n"],["\u003cp\u003eFinally, it provides guidance on how to use the Chrome Policy API to approve, deny, or force-install extension requests for specific organizational units.\u003c/p\u003e\n"]]],[],null,["# Code Samples for the Chrome Management App / Extension Details API\n\nVisit\n[Chrome Management App Details API](/chrome/management/guides/app_details_api)\nfor an overview of API features.\n\nAll the requests shown below use the following variables:\n\n- `$TOKEN` - OAuth 2 token\n- `$CUSTOMER` - ID of the customer or literal `my_customer`\n\nGet details for a Chrome app / extension\n----------------------------------------\n\nTo view details about a specific Chrome app, use the\n`/apps/chrome/{app_id}@{app_version}` endpoint.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef@1.2.3\"\n\n#### Response\n\n {\n \"name\": \"customers/\u003ccustomer\u003e/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef@1.2.3\",\n \"displayName\": \"Sample Google Chrome Extension\",\n \"description\": \"A sample Google Chrome extension.\",\n \"revisionId\": \"1.2.3\",\n \"type\": \"CHROME\",\n \"iconUri\": \"https://sample.chrome.extension.google.com/icon.png\",\n \"detailUri\": \"https://chrome.google.com/webstore/detail/abcdefghijklmnopqrstuvwxyzabcdef\",\n \"firstPublishTime\": \"2010-10-10T10:10:10.123456Z\",\n \"latestPublishTime\": \"2020-10-10T10:10:10.123456Z\",\n \"publisher\": \"sample.com\",\n \"homepageUri\": \"http://sample.chrome.extension.google.com/home\",\n \"reviewNumber\": \"10000\",\n \"reviewRating\": 4.5,\n \"chromeAppInfo\": {\n \"supportEnabled\": false,\n \"minUserCount\": 6000000,\n \"permissions\": [\n {\n \"type\": \"content_security_policy\",\n \"documentationUri\": \"https://developer.chrome.com/extensions/contentSecurityPolicy\",\n \"accessUserData\": false\n },\n {\n \"type\": \"contextmenus\",\n \"documentationUri\": \"https://developer.chrome.com/extensions/contextMenus\",\n \"accessUserData\": false\n },\n ],\n \"siteAccess\": [\n {\n \"hostMatch\": \"\u003call_urls\u003e\"\n }\n ],\n \"isTheme\": false,\n \"googleOwned\": true,\n \"isCwsHosted\": true\n }\n }\n\nGet details for an Android app\n------------------------------\n\nTo view details about a specific Android app, use the\n`/apps/android/{app_id}@{app_version}` endpoint.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/android/com.google.android.sample@1.2.3\"\n\n#### Response\n\n {\n \"name\": \"customers/\u003ccustomer\u003e/apps/android/com.google.android.sample@1.2.3\",\n \"displayName\": \"Sample Android App\",\n \"description\": \"A sample Android app.\",\n \"appId\": \"com.google.android.sample\",\n \"revisionId\": \"1.2.3\",\n \"type\": \"ANDROID\",\n \"iconUri\": \"https://sample.android.app.google.com/icon.png\",\n \"detailUri\": \"https://play.google.com/store/apps/details?id=com.google.android.sample\",\n \"firstPublishTime\": \"2010-10-10T10:10:10.123456Z\",\n \"latestPublishTime\": \"2020-10-10T10:10:10.123456Z\",\n \"publisher\": \"Google LLC\",\n \"isPaidApp\": true,\n \"homepageUri\": \"http://sample.android.app.google.com/home\",\n \"privacyPolicyUri\": \"http://sample.android.app.google.com/privacy\",\n \"reviewNumber\": \"10000\",\n \"reviewRating\": 4.5,\n \"androidAppInfo\": {\n \"permissions\": [\n {\n \"type\": \"android.permission.CAMERA\"\n },\n ]\n }\n }\n\nGet details for a Progressive Web App\n-------------------------------------\n\nTo view details about a specific Prgoressive Web App, use the\n`/apps/web/{app_id}` endpoint.\nNote that the app id is the URL-encoded app home page.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps/web/http%3A%2F%2Fsample.web.app.google.com%2F\"\n\n#### Response\n\n {\n \"name\": \"customers/\u003ccustomer\u003e/apps/web/http%3A%2F%sample.web.app.google.com%2F\",\n \"displayName\": \"sample.web.app.google.com\",\n \"description\": \"A sample Progressive Web App.\",\n \"appId\": \"http://sample.web.app.google.com/\",\n \"type\": \"WEB\",\n \"iconUri\": \"http://sample.web.app.google.com/icon.png\"\n }\n\nList requested Chrome extensions\n--------------------------------\n\nTo list requested Chrome apps, use the\n`/apps:countChromeAppRequests` endpoint.\n\n#### Request\n\n curl -X GET \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/apps:countChromeAppRequests\"\n\n#### Response\n\n {\n \"requestedApps\": [\n {\n \"appId\": \"abcdefghijklmnopqrstuvwxyzabcdef\",\n \"displayName\": \"Sample Google Chrome Extension\",\n \"appDetails\": \"customers/\u003ccustomer\u003e/apps/chrome/abcdefghijklmnopqrstuvwxyzabcdef\",\n \"iconUri\": \"https://sample.chrome.extension.google.com/icon.png\",\n \"detailUri\": \"https://chrome.google.com/webstore/detail/abcdefghijklmnopqrstuvwxyzabcdef\",\n \"requestCount\": \"1\",\n \"latestRequestTime\": \"2020-10-10T10:10:10.123456Z\"\n },\n ],\n \"totalSize\": 1\n }\n\n### Taking action on extension requests\n\nTo take an appropriate action on app requests from end users, you will need to use the [Chrome Policy API](/chrome/policy). Follow the [setup guide](/chrome/policy/guides/setup) to get access to the API. Then you will be able to make requests to that API to take various actions. Samples for making app related requests can be found [here](/chrome/policy/guides/app_samples_policyapi). The following are examples of common actions you can take on an app request.\n\n#### Approve extension request for manual install by the user/devices under an OU\n\n curl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\n requests: [{\n policyTargetKey: {\n targetResource: \"orgunits/04fatzly4jbjho9\",\n additionalTargetKeys: {\"app_id\": \"chrome:abcdefghijklmnopqrstuvwxyzabcdef\"}\n },\n policyValue: {\n policySchema: \"chrome.users.apps.InstallType\",\n value: {appInstallType: \"ALLOWED\"}\n },\n updateMask: {paths: \"appInstallType\"}\n }]\n }' \\\n \"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify\"\n\nA successful response should be empty: \n\n {}\n\n#### Deny extension request for all users/devices under an OU\n\n curl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\n requests: [{\n policyTargetKey: {\n targetResource: \"orgunits/04fatzly4jbjho9\",\n additionalTargetKeys: {\"app_id\": \"chrome:abcdefghijklmnopqrstuvwxyzabcdef\"}\n },\n policyValue: {\n policySchema: \"chrome.users.apps.InstallType\",\n value: {appInstallType: \"BLOCKED\"}\n },\n updateMask: {paths: \"appInstallType\"}\n }]\n }' \\\n \"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify\"\n\nA successful response should be empty: \n\n {}\n\n#### Force install extension for all users/devices under an OU\n\n curl -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\n requests: [{\n policyTargetKey: {\n targetResource: \"orgunits/04fatzly4jbjho9\",\n additionalTargetKeys: {\"app_id\": \"chrome:abcdefghijklmnopqrstuvwxyzabcdef\"}\n },\n policyValue: {\n policySchema: \"chrome.users.apps.InstallType\",\n value: {appInstallType: \"FORCED\"}\n },\n updateMask: {paths: \"appInstallType\"}\n }]\n }' \\\n \"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify\"\n\nA successful response should be empty: \n\n {}"]]