Enterprises: pullNotificationSet

拉取并返回为与请求通过身份验证的服务帐号关联的企业设置的通知。如果没有待处理的通知,通知集可能为空。
除非通知集为空,否则需要在 20 秒内通过调用 Enterprises.AcknowledgeNotificationSet 来确认返回的通知集。
在 20 秒内未得到确认的通知最终将重新包含在对另一个 PullNotificationSet 请求的响应中,并且根据 Google Cloud Platform Pub/Sub 系统政策,从未确认的通知最终将被删除。
可以并发执行多个请求来检索通知,在这种情况下,待处理的通知(如果有)会在每个调用方之间拆分(如果有待处理)。
如果没有通知,系统会返回空的通知列表。 当后续请求可用时,后续请求可能会返回更多通知。

请求

HTTP 请求

POST https://www.googleapis.com/androidenterprise/v1/enterprises/pullNotificationSet

参数

参数名称 说明
可选的查询参数
requestMode string 用于接收通知的请求模式。
指定 waitForNotifications 会导致请求被阻止并等待出现一条或多条通知,或者如果一段时间后未显示任何通知,则返回空的通知列表。
指定 returnImmediately 将导致请求立即返回待处理的通知;如果没有通知,则为空列表。
如果省略,则默认为 waitForNotifications

可接受的值:
  • returnImmediately
  • waitForNotifications

授权

此请求需要获得以下范围的授权:

范围
https://www.googleapis.com/auth/androidenterprise

如需了解详情,请参阅身份验证和授权页面。

请求正文

使用此方法时请勿提供请求正文。

响应

如果成功,此方法将返回采用以下结构的响应正文:

{
  "kind": "androidenterprise#notificationSet",
  "notificationSetId": string,
  "notification": [
    {
      "enterpriseId": string,
      "timestampMillis": long,
      "notificationType": string,
      "productApprovalEvent": {
        "productId": string,
        "approved": string
      },
      "installFailureEvent": {
        "productId": string,
        "deviceId": string,
        "userId": string,
        "failureReason": string,
        "failureDetails": string
      },
      "appUpdateEvent": {
        "productId": string
      },
      "newPermissionsEvent": {
        "productId": string,
        "requestedPermissions": [
          string
        ],
        "approvedPermissions": [
          string
        ]
      },
      "appRestrictionsSchemaChangeEvent": {
        "productId": string
      },
      "productAvailabilityChangeEvent": {
        "productId": string,
        "availabilityStatus": string
      },
      "newDeviceEvent": {
        "userId": string,
        "deviceId": string,
        "managementType": string,
        "dpcPackageName": string
      },
      "deviceReportUpdateEvent": {
        "userId": string,
        "deviceId": string,
        "report": {
          "lastUpdatedTimestampMillis": long,
          "appState": [
            {
              "packageName": string,
              "keyedAppState": [
                {
                  "key": string,
                  "stateTimestampMillis": long,
                  "severity": string,
                  "message": string,
                  "data": string
                }
              ]
            }
          ]
        }
      }
    }
  ]
}
属性名称 说明 备注
notificationSetId string 通知集 ID,必须使用 Enterprises.AcknowledgeNotification API 将通知标记为已接收。如果没有通知,此字段将被省略。
notification[] list 收到的通知,如果没有通知,则为空。
notification[].enterpriseId string 接收通知的企业的 ID。此字段始终存在。
notification[].timestampMillis long 自 1970-01-01T00:00:00Z 以来以毫秒为单位发布通知的时间。此字段始终存在。
notification[].productApprovalEvent nested object 有关商品审批状态更改的通知。
notification[].productApprovalEvent.productId string 审批状态发生变化的商品 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].productApprovalEvent.approved string 商品是否获得批准。此字段将始终显示。

可接受的值:
  • approved
  • unapproved
  • unknown
notification[].installFailureEvent nested object 关于应用安装失败的通知。
notification[].installFailureEvent.productId string 发生安装失败事件的产品的 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].installFailureEvent.deviceId string 设备的 Android ID。此字段将始终显示。
notification[].installFailureEvent.userId string 用户的 ID。此字段将始终显示。
notification[].installFailureEvent.failureReason string 安装失败的原因。此字段将始终显示。

可接受的值:
  • timeout
  • unknown
notification[].installFailureEvent.failureDetails string 有关失败情况的其他详细信息(如果适用)。
notification[].appUpdateEvent nested object 关于应用更新的通知。
notification[].appUpdateEvent.productId string 已更新的产品的 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].newPermissionsEvent nested object 有关新应用权限的通知。
notification[].newPermissionsEvent.productId string 添加了新权限的产品 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].newPermissionsEvent.requestedPermissions[] list 应用当前请求的一组权限。使用 EMM API 中的 Permissions.Get 检索关于这些权限的详细信息。
notification[].newPermissionsEvent.approvedPermissions[] list 企业管理员已针对此应用批准的一组权限。使用 EMM API 中的 Permissions.Get 检索关于这些权限的详细信息。
notification[].appRestrictionsSchemaChangeEvent nested object 有关新应用限制架构更改的通知。
notification[].appRestrictionsSchemaChangeEvent.productId string 应用限制架构发生更改的产品的 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].productAvailabilityChangeEvent nested object 有关商品库存状况变化的通知。
notification[].productAvailabilityChangeEvent.productId string 产品供应情况发生变化的产品的 ID(例如“app:com.google.android.gm”)。此字段将始终显示。
notification[].productAvailabilityChangeEvent.availabilityStatus string 商品的新状态。此字段将始终显示。

可接受的值:
  • available
  • removed
  • unknown
  • unpublished
notification[].newDeviceEvent nested object 关于新设备的通知。
notification[].newDeviceEvent.userId string 用户的 ID。此字段将始终显示。
notification[].newDeviceEvent.deviceId string 设备的 Android ID。此字段将始终显示。
notification[].newDeviceEvent.managementType string 确定 Android EMM 在各种部署配置中的控制程度。

可能的值包括:
  • managedDevice”,即 DPC 设为设备所有者的设备,
  • managedProfile”,即 DPC 设为资料所有者的设备。


可接受的值:
  • managedDevice
  • managedProfile
notification[].notificationType string 通知的类型。

可接受的值:
  • appRestricionsSchemaChange
  • appUpdate
  • deviceReportUpdate
  • installFailure
  • newDevice
  • newPermissions
  • productApproval
  • productAvailabilityChange
  • testNotification
  • unknown
notification[].newDeviceEvent.dpcPackageName string 设备上的政策应用。
notification[].deviceReportUpdateEvent nested object 关于设备报告更新的通知。
notification[].deviceReportUpdateEvent.userId string 用户的 ID。此字段将始终显示。
notification[].deviceReportUpdateEvent.deviceId string 设备的 Android ID。此字段将始终显示。
notification[].deviceReportUpdateEvent.report nested object 设备报告更新了应用的最新状态。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.lastUpdatedTimestampMillis long 上次报告更新的时间戳(以毫秒为单位,从 Epoch 起算)。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[] list 由设备上的受管理应用设置的应用状态列表。应用状态由应用开发者定义。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[].packageName string 应用的软件包名称。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[] list 键控应用状态列表。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].key string 指示应用提供状态的键。该密钥的内容由应用开发者设置。为了防止 XSS,我们建议您先从密钥中移除所有 HTML,然后再显示。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].stateTimestampMillis long 应用设置状态时的时间戳(以毫秒为单位,从 Epoch 起算)。此字段将始终显示。
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].severity string 应用状态的严重性。此字段将始终显示。

可接受的值:
  • severityError
  • severityInfo
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].message string 人类可读的自由格式消息,用于描述应用状态。例如,错误消息。为防止出现 XSS,我们建议您先移除消息中的所有 HTML,然后再显示它。
notification[].deviceReportUpdateEvent.report.appState[].keyedAppState[].data string 用于存储机器可读数据的额外字段。例如,数字或 JSON 对象。为了防止 XSS,我们建议您先从数据中移除所有 HTML,然后再显示这些数据。
kind string