- 最新
- 最多得票
- 最多評論
When your buyers on Amazon marketplace creates a new contract, upgrade it, renew it, or if the contract expires a notification will be published to the "aws-mp-entitlement-notification" SNS topic. The notification sent to this topic will have the following three key piece of information:
{
"action": "<action-name>",
"customer-identifier": " X01EXAMPLEX",
"product-code": "n0123EXAMPLEXXXXXXXXXXXX",
}
Even though the "action" attribute key will always have the value "entitlement-updated", the buyer/customer identity will be provided using the attribute key "customer-identifier".
When the aws-mp-entitlement-notification SNS topic forwards this message to your SQS queue, the message would look similar to the following:
{
"Type" : "Notification",
"MessageId" : "63a3f6b6-d533-4a47-aef9-fcf5cf758c76",
"TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
"Message" : "{\n \"action\": \"<action-name>\",\n \"customer-identifier\": \" X01EXAMPLEX\",\n \"product-code\": \"n0123EXAMPLEXXXXXXXXXXXX\",\n}",
"Timestamp" : "2012-03-29T05:12:16.901Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEnTrFPa3...",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
"UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:c7fe3a54-ab0e-4ec2-88e0-db410a0f2bee"
}
The details on "customer-identifier" and "product-code" will be part of the "Message" attribute key on the SQS queue message as mentioned above.
...
"Message" : "{\n \"action\": \"<action-name>\",\n \"customer-identifier\": \" X01EXAMPLEX\",\n \"product-code\": \"n0123EXAMPLEXXXXXXXXXXXX\",\n}",
...
You can then make the "GetEntitlements" API call and make use of the "customer-identifier" and "product-code" from the SQS message.
While making the GetEntitlements, you will have to pass the "product-code" from SQS message as the "ProductCode" request parameter. You will then have to use the "Filter" request parameter and pass customer identifier you obtained from SQS message as a value to the CUSTOMER_IDENTIFIER filter key.
This API call will return the entitlements specific to the customer identified by the customer-identifier and the product code identified by product-code in the SQS message.
For example, with python programming language using boto3 SDK you have make the "get_entitlements" function call:
response = client.get_entitlements(
ProductCode='n0123EXAMPLEXXXXXXXXXXXX',
Filter={
'CustomerIdentifier': [
'X01EXAMPLEX',
]
}
)
相關內容
- AWS 官方已更新 8 個月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 7 個月前
Thank you so much for this detailed answer. I was stuck over here. Now I will be able to continue from here. Thanks again for your help!