请访问 Chrome Management App Details API 简要了解 API 功能。
下面显示的所有请求都使用以下变量:
$TOKEN
- OAuth 2 令牌$CUSTOMER
- 客户 ID 或实际值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"
},
]
}
}
获取渐进式 Web 应用的详细信息
如需查看有关特定 Prgoressive Web 应用的详细信息,请使用
/apps/web/{app_id}
端点发送。
请注意,应用 ID 是经过网址编码的应用首页。
请求
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 发出请求,以执行各种操作。如需查看发出应用相关请求的示例,请点击此处。以下是您可以对应用请求执行的常见操作示例。
批准组织部门下的用户/设备的手动安装扩展程序请求
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"
成功的响应应该为空:
{}
拒绝组织部门下所有用户/设备的扩展程序请求
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"
成功的响应应该为空:
{}
为组织部门下的所有用户/设备强制安装扩展程序
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"
成功的响应应该为空:
{}