createEventSubscription
Version 2024-01-01
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.
Overview
Create an event subscription to receive an eventType.
Response
Return type CreateEventSubscriptionResponse
Arguments
Argument | Description |
---|---|
input (CreateEventSubscriptionInput required) | Input parameters used when creating an event subscription |
Examples
Create Event Subscription Using Event Bridge Input
Request
mutation {
createEventSubscription(
input: {
destination: {
eventBridge: {
partnerEventSource: {
account: "919191919191",
name: "BuyWithPrimeEventSource"
}
region: "us-east-1"
}
}
eventType: "DELIVERY_COMPLETED"
}
) {
subscriptionId
}
}
Response
{
"data": {
"createEventSubscription": {
"subscriptionId": "8e5da864-34ee-461d-9d76-0babcef14677"
}
}
}
Create Event Subscription With Invalid Event Type Using Event Bridge Input
Request
mutation {
createEventSubscription(
input: {
destination: {
eventBridge: {
partnerEventSource: {
account: "919191919191",
name: "BuyWithPrimeEventSource"
}
region: "us-east-1"
}
}
eventType: "INVALID_EVENT"
}
) {
subscriptionId
}
}
Response
{
"errors": [
{
"message": "You do not have sufficient access to perform this action.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createEventSubscription"
],
"extensions": {
"classification": {
"type": "AccessDeniedError",
"errorType": "AccessDeniedException",
"errorCode": 403
}
}
}
],
"data": null
}
Create Event Subcription With Invalid Region Using Event Bridge Input
Request
mutation {
createEventSubscription(
input: {
destination: {
eventBridge: {
partnerEventSource: {
account: "919191919191",
name: "BuyWithPrimeEventSource"
}
region: "invalidRegion"
}
}
eventType: "DELIVERY_COMPLETED"
}
) {
subscriptionId
}
}
Response
{
"errors": [
{
"message": "Input request is not valid, the following issues were encountered: [/createEventSubscription/input/destination/eventBridge/region must match \"^(us(-gov)?|ap|ca|cn|eu|sa|af)-(central|(north|south)?(east|west)?)-[0-9]$\"]",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"createEventSubscription"
],
"extensions": {
"classification": {
"type": "ValidationError",
"code": "ValidationError",
"details": {},
"errorType": "ValidationException",
"errorCode": 400
}
}
}
],
"data": null
}
Updated 3 days ago