移动推送 API 操作 - Amazon Simple Notification Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

移动推送 API 操作

要使用 Amazon SNS 移动推送 API,必须首先满足推送通知服务(如 Apple Push Notification Service (APNs) 和 Firebase Cloud Messaging (FCM))的先决条件。有关这些先决条件的更多信息,请参阅Amazon SNS 用户通知的先决条件

要使用 API 将推送通知消息发送到移动应用程序和设备,必须首先使用 CreatePlatformApplication 操作,它返回 PlatformApplicationArn 属性。然后 PlatformApplicationArn 使用 CreatePlatformEndpoint 属性,返回 EndpointArn 属性。之后,可以在 EndpointArn 操作中使用 Publish 属性将通知消息发送到移动应用程序和设备,也可以在 EndpointArn 操作中使用 Subscribe 属性订阅主题。有关更多信息,请参阅 用户通知流程概述

Amazon SNS 移动推送 API 如下:

CreatePlatformApplication

为设备和移动应用程序可能注册的受支持推送通知服务(如 APNs 和 FCM)之一创建平台应用程序对象。返回 PlatformApplicationArn 操作所使用的 CreatePlatformEndpoint 属性。

CreatePlatformEndpoint

为受支持推送通知服务上的设备和移动应用程序创建终端节点。CreatePlatformEndpoint 使用从 PlatformApplicationArn 操作返回的 CreatePlatformApplication 属性。EndpointArn 属性是使用 CreatePlatformEndpoint 时返回的,它用在 Publish 操作中将通知消息发送到移动应用程序和设备。

CreateTopic

创建可以发布消息的主题。

DeleteEndpoint

删除一个受支持推送通知服务上的设备和移动应用程序的终端节点。

DeletePlatformApplication

删除平台应用程序数据元。

DeleteTopic

删除主题及其所有订阅。

GetEndpointAttributes

检索设备和移动应用程序的终端节点属性。

GetPlatformApplicationAttributes

检索平台应用程序数据元的属性。

ListEndpointsByPlatformApplication

列出受支持推送通知服务中的设备和移动应用程序的终端节点和终端节点属性。

ListPlatformApplications

列出受支持推送通知服务的平台应用程序数据元。

Publish

向主题的所有订阅终端节点发送通知消息。

SetEndpointAttributes

设置设备和移动应用程序的终端节点属性。

SetPlatformApplicationAttributes

设置平台应用程序数据元的属性。

Subscribe

准备通过向终端节点发送确认消息来订阅终端节点。要实际创建订阅,终端节点所有者必须使用确认消息中的令牌调用 ConfirmSubscription 操作。

Unsubscribe

删除订阅。