Chrome 관리 앱 / 확장 프로그램 세부정보 API용 코드 샘플

API 기능의 개요는 Chrome Management App Details 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"
            },
        ]
    }
}

프로그레시브 웹 앱 세부정보 보기

특정 Prgoressive 웹 앱에 대한 세부정보를 보려면 /apps/web/{app_id} 엔드포인트를 사용합니다. 앱 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"

성공 응답은 비어 있어야 합니다.

{}