คำขอด้านล่างแสดงการจัดการนโยบายด้วย Policy API โดยใช้นโยบายแอปเป็นตัวอย่าง ก่อนเริ่มต้น โปรดอ่านภาพรวมของ Chrome Policy API และคู่มือสคีมานโยบาย
คำขอทั้งหมดที่แสดงอยู่ด้านล่างใช้ตัวแปรต่อไปนี้
$TOKEN
- โทเค็น OAuth 2$CUSTOMER
- รหัสลูกค้าหรือลิเทอรัลmy_customer
บังคับติดตั้งแอป
ตัวอย่างต่อไปนี้มีไว้สำหรับหน่วยขององค์กร คำขอ Group จะเหมือนกัน ยกเว้น targetResource ซึ่งจะมี "groups/" แทนที่จะเป็น "orgunits/" ก่อนรหัส
เรากำลังตั้งค่าแอป Google วาดเขียนให้บังคับติดตั้ง ดังนี้
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"}
},
policyValue: {
policySchema: "chrome.users.apps.InstallType",
value: {appInstallType: "FORCED"}
},
updateMask: {paths: "appInstallType"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
การตอบกลับที่สำเร็จควรเว้นว่างไว้
{}
ตัวอย่างนี้มีไว้สำหรับแอปของผู้ใช้ คำขอเซสชันผู้มาเยือนที่มีการจัดการจะเหมือนกันทุกประการ ยกเว้นสคีมานโยบายจะเป็น chrome.devices.managedguest.apps.InstallType
คำขอนโยบายแอปคีออสก์ที่เทียบเท่ามีดังนี้
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"}
},
policyValue: {
policySchema: "chrome.devices.kiosk.apps.ForceInstall",
value: {forceInstall: false}
},
updateMask: {paths: "forceInstall"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
การตอบกลับที่สำเร็จควรเว้นว่างไว้
{}
การลบแอป
การลบแอปต้องทำในหน่วยขององค์กรที่มีการเพิ่มแอปสำหรับการจัดการไว้อย่างชัดเจน เมื่อเรียกใช้โซลูชัน ช่อง addedSourceKey
จะมีหน่วยขององค์กรที่เพิ่มไว้สำหรับการจัดการ กล่าวคือ ควรเรียกใช้ delete
สําหรับแอปที่หน่วยขององค์กรใน addedSourceKey
เท่ากับแอปใน policyTargetKey
เท่านั้น
หากต้องการลบแอป (นำแอปออกจากการจัดการอย่างชัดแจ้ง) คุณควรส่งคำขอ batchInherit
ซึ่งมี policySchema
เป็นสคีมาสำหรับประเภทแอปที่ระบุ พร้อมเครื่องหมายดอกจัน (*) แทนนโยบายเฉพาะ ในตัวอย่างนี้
เรากำลังลบแอป Google วาดเขียนซึ่งติดตั้งไว้ที่หน่วยขององค์กร "04fatzly4jbjho9"
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:gbchcmhmhahfdphkhkmpfmihenigjmpp"}
},
policySchema: "chrome.users.apps.*",
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchInherit"
การตอบกลับที่สำเร็จควรเว้นว่างไว้
{}
คำขอลบแอปคีออสก์และแอปเซสชันผู้เยี่ยมชมที่มีการจัดการจะใช้สคีมา chrome.devices.kiosk.apps.\*
และ chrome.devices.managedguest.apps.\*
ตามลำดับ
รับนโยบายการติดตั้งแอปสำหรับแอปในหน่วยขององค์กร
หากต้องการรับนโยบายสำหรับแอปที่เจาะจง คุณต้องระบุทั้งนโยบายและรหัสแอปในคำขอ ในตัวอย่างนี้ เรากำลังอ่านค่าของนโยบาย InstallType สำหรับแอป Google วาดเขียน
ส่งคำขอ
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"}
},
policySchemaFilter: "chrome.users.apps.InstallType"
}' \
"https://chromepolicy.googleapis.com/v1/$CUSTOMER/C02l1chq7/policies:resolve"
คำตอบ
{
"resolvedPolicies": [
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "FORCED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
}
]
}
รับนโยบายการติดตั้งแอปสำหรับแอปทั้งหมดในหน่วยขององค์กร
ถ้าไม่มีรหัสแอปจากคำขอในตัวอย่างก่อนหน้านี้ รหัสดังกล่าวจะกลายเป็นคำขอค่าของนโยบาย InstallType สำหรับแอปทั้งหมดภายใต้ OU นั้น
ส่งคำขอ
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
},
policySchemaFilter: "chrome.users.apps.InstallType"
}' \
"https://chromepolicy.googleapis.com/v1/$CUSTOMER/C02l1chq7/policies:resolve"
คำตอบ
{
"resolvedPolicies": [
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "FORCED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:fhcfdhnmhdkemdfdncjmgnanbekfmbab"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "ALLOWED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
...
]
}
แสดงรายการนโยบายทั้งหมดสำหรับแอปในหน่วยขององค์กร
คุณรับนโยบายทั้งหมดสำหรับแอปเดียวได้โดยใช้ไวลด์การ์ดในนโยบาย เหมือนกับที่ละเว้นรหัสแอปจากคำขอในการเรียกนโยบายสำหรับทุกแอปได้ ในตัวอย่างนี้ เราจะรับค่าของนโยบายทั้งหมดสำหรับแอป Google วาดเขียน
ส่งคำขอ
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9",
additionalTargetKeys: {"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"}
},
policySchemaFilter: "chrome.users.apps.*"
}' \
"https://chromepolicy.googleapis.com/v1/$CUSTOMER/C02l1chq7/policies:resolve"
คำตอบ
{
"resolvedPolicies": [
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "FORCED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.IncludeInChromeWebStoreCollection",
"value": {
"includeInCollection": true
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
...
]
}
แสดงรายการนโยบายทั้งหมดสำหรับแอปทั้งหมดในหน่วยขององค์กร
คุณละเว้นรหัสแอปและใช้ไวลด์การ์ดในนโยบายได้เพื่อขอการตั้งค่าแอปทั้งหมดสําหรับแอปทั้งหมดภายใต้ OU
ส่งคำขอ
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9"
},
policySchemaFilter: "chrome.users.apps.*"
}' \
"https://chromepolicy.googleapis.com/v1/$CUSTOMER/C02l1chq7/policies:resolve"
คำตอบ
{
"resolvedPolicies": [
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "FORCED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:mkaakpdehdafacodkgkpghoibnmamcme"
}
},
"value": {
"policySchema": "chrome.users.apps.IncludeInChromeWebStoreCollection",
"value": {
"includeInCollection": true
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:fhcfdhnmhdkemdfdncjmgnanbekfmbab"
}
},
"value": {
"policySchema": "chrome.users.apps.InstallType",
"value": {
"appInstallType": "ALLOWED"
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
{
"targetKey": {
"targetResource": "orgunits/04fatzly4jbjho9",
"additionalTargetKeys": {
"app_id": "chrome:fhcfdhnmhdkemdfdncjmgnanbekfmbab"
}
},
"value": {
"policySchema": "chrome.users.apps.CertificateManagement",
"value": {
"allowAccessToKeys": true
}
},
"sourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
},
"addedSourceKey": {
"targetResource": "orgunits/04fatzly4jbjho9"
}
},
...
]
}
การล้างข้อมูล Kiosk Appsconfig AutoLaunchApp
หากต้องการล้าง AutoLaunchApp คุณสามารถตั้งค่า appId เป็น "None"
โปรดทราบว่าเมื่อตั้งค่า appId เป็น "None" การตั้งค่า AutoLaunchApp อื่นๆ ทั้งหมดจะถูกตั้งค่าเป็นค่าเริ่มต้น ในกรณีนี้ ระบบจะไม่สนใจการตั้งค่า AutoLaunchApp นอกเหนือจาก appId ที่ส่งในคำขอ
ส่งคำขอ
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
requests: [{
policyTargetKey: {
targetResource: "orgunits/04fatzly4jbjho9"
},
policyValue: {
policySchema: "chrome.devices.kiosk.appsconfig.AutoLaunchApp",
value: {appId: "None"}
},
updateMask: {paths: "appId"}
}]
}' \
"https://chromepolicy.googleapis.com/v1/customers/$CUSTOMER/policies/orgunits:batchModify"
คำตอบ
การตอบกลับที่สำเร็จว่างเปล่า
{}