

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

# 移动推送 API 操作
<a name="mobile-push-api"></a>

要使用 Amazon SNS 移动推送 API，必须首先满足推送通知服务（如 Apple Push Notification Service (APNs) 和 Firebase Cloud Messaging (FCM)）的先决条件。有关这些先决条件的更多信息，请参阅[Amazon SNS 用户通知的先决条件](sns-prerequisites-for-mobile-push-notifications.md)。

 要使用 API 将推送通知消息发送到移动应用程序和设备，必须首先使用 `CreatePlatformApplication` 操作，它返回 `PlatformApplicationArn` 属性。然后 `PlatformApplicationArn` 使用 `CreatePlatformEndpoint` 属性，返回 `EndpointArn` 属性。之后，可以在 `EndpointArn` 操作中使用 `Publish` 属性将通知消息发送到移动应用程序和设备，也可以在 `EndpointArn` 操作中使用 `Subscribe` 属性订阅主题。有关更多信息，请参阅 [使用 Amazon SNS 设置推送通知](sns-mobile-application-as-subscriber.md#sns-user-notifications-process-overview)。

Amazon SNS 移动推送 API 如下：

`[CreatePlatformApplication](https://docs.aws.amazon.com/sns/latest/api/API_CreatePlatformApplication.html)`  
为设备和移动应用程序可能注册的受支持推送通知服务（如 APNs 和 FCM）之一创建平台应用程序对象。返回 `PlatformApplicationArn` 操作所使用的 `CreatePlatformEndpoint` 属性。

`[CreatePlatformEndpoint](https://docs.aws.amazon.com/sns/latest/api/API_CreatePlatformEndpoint.html)`  
为受支持推送通知服务上的设备和移动应用程序创建终端节点。`CreatePlatformEndpoint` 使用从 `PlatformApplicationArn` 操作返回的 `CreatePlatformApplication` 属性。`EndpointArn` 属性是使用 `CreatePlatformEndpoint` 时返回的，它用在 `Publish` 操作中将通知消息发送到移动应用程序和设备。

`[CreateTopic](https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html)`  
创建可以发布消息的主题。

`[DeleteEndpoint](https://docs.aws.amazon.com/sns/latest/api/API_DeleteEndpoint.html)`  
删除一个受支持推送通知服务上的设备和移动应用程序的终端节点。

`[DeletePlatformApplication](https://docs.aws.amazon.com/sns/latest/api/API_DeletePlatformApplication.html)`  
删除平台应用程序数据元。

`[DeleteTopic](https://docs.aws.amazon.com/sns/latest/api/API_DeleteTopic.html)`  
删除主题及其所有订阅。

`[GetEndpointAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetEndpointAttributes.html)`  
检索设备和移动应用程序的终端节点属性。

`[GetPlatformApplicationAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetPlatformApplicationAttributes.html)`  
检索平台应用程序数据元的属性。

`[ListEndpointsByPlatformApplication](https://docs.aws.amazon.com/sns/latest/api/API_ListEndpointsByPlatformApplication.html)`  
列出受支持推送通知服务中的设备和移动应用程序的终端节点和终端节点属性。

`[ListPlatformApplications](https://docs.aws.amazon.com/sns/latest/api/API_ListPlatformApplications.html)`  
列出受支持推送通知服务的平台应用程序数据元。

`[Publish](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html)`  
向主题的所有订阅终端节点发送通知消息。

`[SetEndpointAttributes](https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html)`  
设置设备和移动应用程序的终端节点属性。

`[SetPlatformApplicationAttributes](https://docs.aws.amazon.com/sns/latest/api/API_SetPlatformApplicationAttributes.html)`  
设置平台应用程序数据元的属性。

`[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)`  
准备通过向终端节点发送确认消息来订阅终端节点。要实际创建订阅，终端节点所有者必须使用确认消息中的令牌调用 ConfirmSubscription 操作。

`[Unsubscribe](https://docs.aws.amazon.com/sns/latest/api/API_Unsubscribe.html)`  
删除订阅。