

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

# HTTP/HTTPS 取消订阅确认 JSON 格式
<a name="http-unsubscribe-confirmation-json"></a>

在 HTTP/HTTPS 终端节点取消订阅主题后，Amazon SNS 会向该终端节点发送取消订阅确认消息。

取消订阅确认消息是一条 POST 消息，消息正文包含一个带以下名称/值对的 JSON 格式文档。

**`Type`**  
消息类型。为取消订阅确认，消息类型为`UnsubscribeConfirmation`。

**`MessageId`**  
通用唯一标识符（UUID），它对于每条发布的消息是唯一的。对于 Amazon SNS 在重试期间重新发送的消息，原始消息的消息 ID 被使用。

**`Token`**  
您可以使用 [https://docs.aws.amazon.com/sns/latest/api/API_ConfirmSubscription.html](https://docs.aws.amazon.com/sns/latest/api/API_ConfirmSubscription.html) 操作重新确认订阅的一个值。或者，您只需访问`SubscribeURL`。

**`TopicArn`**  
此终端节点已经从主题取消订阅的 Amazon Resource Name (ARN)。

**`Message`**  
一个描述消息的字符串。为了取消订阅确认，字符串应看起来像这样：  

```
You have chosen to deactivate subscription arn:aws:sns:us-east-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55.\nTo cancel this operation and restore the subscription, visit the SubscribeURL included in this message.
```

**`SubscribeURL`**  
为了重新确认订阅，您必须访问的 URL。或者，您可以改为将 `Token` 与 [https://docs.aws.amazon.com/sns/latest/api/API_ConfirmSubscription.html](https://docs.aws.amazon.com/sns/latest/api/API_ConfirmSubscription.html) 操作结合使用以重新确认订阅。

**`Timestamp`**  
取消订阅确认发送的时间(GMT)。

**`SignatureVersion`**  
所用 Amazon SNS 签名的版本。  
+ 如果 `SignatureVersion` 为 **1**，则 `Signature` 是 `Message`、`MessageId`、`Type`、`Timestamp` 和 `TopicArn` 值的 Base64 编码 `SHA1withRSA` 签名。
+ 如果 `SignatureVersion` 为 **2**，则 `Signature` 是 `Message`、`MessageId`、`Type`、`Timestamp` 和 `TopicArn` 值的 Base64 编码 `SHA256withRSA` 签名。

**`Signature`**  
`Message`、`MessageId`、`Type`、`Timestamp` 和 `TopicArn` 值的 Base64 编码 `SHA1withRSA` 或 `SHA256withRSA` 签名。

**`SigningCertURL`**  
用于签署消息的证书的 URL。

以下 HTTP POST 消息是发送至 HTTP 端点的一条 `UnsubscribeConfirmation` 消息的示例。

```
POST / HTTP/1.1
x-amz-sns-message-type: UnsubscribeConfirmation
x-amz-sns-message-id: 47138184-6831-46b8-8f7c-afc488602d7d
x-amz-sns-topic-arn: arn:aws:sns:us-west-2:123456789012:MyTopic
x-amz-sns-subscription-arn: arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55
Content-Length: 1399
Content-Type: text/plain; charset=UTF-8
Host: myhost.example.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent

{
  "Type" : "UnsubscribeConfirmation",
  "MessageId" : "47138184-6831-46b8-8f7c-afc488602d7d",
  "Token" : "2336412f37...",
  "TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
  "Message" : "You have chosen to deactivate subscription arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55.\nTo cancel this operation and restore the subscription, visit the SubscribeURL included in this message.",
  "SubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=2336412f37fb6...",
  "Timestamp" : "2012-04-26T20:06:41.581Z",
  "SignatureVersion" : "1",
  "Signature" : "EXAMPLEHXgJm...",
  "SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem"
}
```