Create and Delete Event Subscriptions
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
This topic contains examples of requests and responses that show how toSubscribe to Events.
To learn how to call the Buy with Prime API, see Call the Buy with Prime API.
For troubleshooting, see Troubleshoot Events.
Create an event subscription
Important
To subscribe to events with a webhook endpoint destination, reach out to your Buy with Prime solution architect.
The following example uses the createEventSubscription
mutation to subscribe to the REFUND_REQUESTED
event.
For a list of event types, see Event Types.
After successful completion of this request, you will see a new partner event source in the Amazon EventBridge console.
Request
// GraphQL mutation
mutation{
createEventSubscription(
input:{
destination:{
eventBridge:{
region:"us-east-1"
partnerEventSource:{
account:"example-aws-account-id"
name:"example-partner-event-source-name"
}
}
}
eventType:"REFUND_REQUESTED"
}
){
subscriptionId
}
}
Response
{
"data": {
"createEventSubscription": {
"subscriptionId": "example-subscription-id"
}
}
}
Delete an event subscription
The following example uses the deleteEventSubscription
mutation to delete the subscription with the specified subscriptionId
.
Request
// GraphQL mutation
mutation{
deleteEventSubscription(subscriptionId:"example-subscription-id"){
subscriptionId
}
}
Response
{
"data": {
"deleteEventSubscription": {
"subscriptionId": "example-subscription-id"
}
}
}
Related topics
Updated about 16 hours ago