获取应用安装和许可详情

本文档通过提供 Google Workspace Marketplace API 的请求和响应示例,展示了如何获取 Google Workspace Marketplace 应用的安装和许可详细信息。

应用由管理员安装

cymbalgroup.com 的管理员为组织中的所有人安装了该应用。

userLicense.get 请求

此请求会调用 userLicense.get 方法来获取 user1@cymbalgroup.com 的许可状态,以确定该用户是否有权使用相应应用。

GET /appsmarket/v2/userLicense/{applicationId}/{userId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/userLicense/APPLICATION_ID/user1@cymbalgroup.com

响应正文

由于 cymbalgroup.com 已安装该应用,因此响应会针对 user1@cymbalgroup.com 返回 userLicense 资源。userLicense 资源的 enabled 字段设置为 true,表示 cymbalgroup.com 的网域管理员已为该网域启用该应用;state 字段设置为 ACTIVE,表示 user1@cymbalgroup.com 拥有有效许可,应允许其使用该应用。

{
  "kind": "appsmarket#userLicense",
  "enabled": true,
  "state": "ACTIVE",
  "editionId": "default_edition",
  "customerId": "user1@cymbalgroup.com",
  "applicationId": "APPLICATION_ID",
  "id": "USER_LICENSE_ID",
  "userId": "user1@cymbalgroup.com"
}

customerLicense.get 请求

此请求会调用 customerLicense.get 方法来获取 cymbalgroup.com 的许可状态,以确定他们是否有权访问该应用。

GET /appsmarket/v2/customerLicense/{applicationId}/{customerId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/customerLicense/APPLICATION_ID/cymbalgroup.com

响应正文

响应会返回 cymbalgroup.com 的 customerLicense 资源,其中 state 字段设置为 ACTIVE,表示客户拥有有效许可。

{
  "kind": "appsmarket#customerLicense",
  "id": "CUSTOMER_LICENSE_ID",
  "applicationId": "APPLICATION_ID",
  "customerId": "cymbalgroup.com",
  "state": "ACTIVE",
  "editions": [
    {
      "editionId": "default_edition",
      "seatCount": -1
    }
  ]
}

应用仅由管理员为特定用户的组织部门安装

现在,只有管理员才能为 user2@cymbalgroup.com 的组织部门 (OU) 安装该应用。不再由管理员为组织中的所有人安装。

userLicense.get 请求

此请求会调用 userLicense.get 方法来获取 user3@cymbalgroup.com 的许可状态,以确定该用户是否有权使用相应应用。

GET /appsmarket/v2/userLicense/{applicationId}/{userId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/userLicense/APPLICATION_ID/user3@cymbalgroup.com

响应正文

由于该应用仅由管理员为 user2@cymbalgroup.com 安装,因此针对 user3@cymbalgroup.com 的响应会返回一个 userLicense 资源,该资源的 enabled 字段设置为 false,表示 cymbalgroup.com 的网域管理员尚未为该网域启用该应用;state 字段设置为 ACTIVE,表示该用户拥有有效许可,应允许其使用该应用。

{
  "kind": "appsmarket#userLicense",
  "enabled": false,
  "state": "ACTIVE",
  "editionId": "default_edition",
  "customerId": "cymbalgroup.com",
  "applicationId": "APPLICATION_ID",
  "id": "USER_LICENSE_ID",
  "userId": "user3@cymbalgroup.com"
}

userLicense.get 请求

此请求会调用 userLicense.get 方法来获取 user2@cymbalgroup.com 的许可状态,以确定该用户是否有权使用相应应用。

GET /appsmarket/v2/userLicense/{applicationId}/{userId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/userLicense/APPLICATION_ID/user2@cymbalgroup.com

响应正文

由于该应用仅由管理员为 user2@cymbalgroup.com 安装,因此响应会针对 user2@cymbalgroup.com 返回一个 userLicense 资源,该资源的 enabled 字段设置为 truestate 字段设置为 ACTIVE

{
  "kind": "appsmarket#userLicense",
  "enabled": true,
  "state": "ACTIVE",
  "editionId": "default_edition",
  "customerId": "cymbalgroup.com",
  "applicationId": "APPLICATION_ID",
  "id": "USER_LICENSE_ID",
  "userId": "user2@cymbalgroup.com"
}

系统会为组织中的所有人删除相应应用

即使该应用已从组织中所有用户的设备中删除,user1@cymbalgroup.com 仍可访问该应用,因为他们之前单独安装了该应用。

userLicense.get 请求

此请求会调用 userLicense.get 方法来获取 user2@cymbalgroup.com 的许可状态,以确定该用户是否有权使用相应应用。

GET /appsmarket/v2/userLicense/{applicationId}/{userId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/userLicense/APPLICATION_ID/user2@cymbalgroup.com

响应正文

由于该应用已针对组织中的所有用户删除,因此响应会针对 user2@cymbalgroup.com 返回一个 userLicense 资源,该资源的 enabled 字段设置为 falsestate 字段设置为 UNLICENSED,表明相应用户的网域管理员未向该用户分配该应用的席位。

{
  "kind": "appsmarket#userLicense",
  "enabled": false,
  "state": "UNLICENSED",
  "applicationId": "APPLICATION_ID",
  "id": "USER_LICENSE_ID",
  "userId": "user2@cymbalgroup.com"
}

userLicense.get 请求

此请求会调用 userLicense.get 方法来获取 user1@cymbalgroup.com 的许可状态,以确定该用户是否有权使用相应应用。

GET /appsmarket/v2/userLicense/{applicationId}/{userId}

curl -H "Authorization: Bearer {TOKEN}" https://appsmarket.googleapis.com/appsmarket/v2/userLicense/APPLICATION_ID/user1@cymbalgroup.com

响应正文

由于 user1@cymbalgroup.com 之前单独安装了该应用,因此他们仍有权使用该应用。响应会返回一个 userLicense 资源,该资源的 enabled 字段设置为 truestate 字段设置为 ACTIVE

{
  "kind": "appsmarket#userLicense",
  "enabled": true,
  "state": "ACTIVE",
  "editionId": "default_edition",
  "customerId": "user1@cymbalgroup.com",
  "applicationId": "APPLICATION_ID",
  "id": "USER_LICENSE_ID",
  "userId": "user1@cymbalgroup.com"
}