Query Event Subscriptions

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

This topic contains examples of requests and responses that show how to query the Buy with Prime Event interface.

To learn how to call the Buy with Prime API, see Call the Buy with Prime API.

For troubleshooting, see Troubleshoot Events.


Get an event subscription

The following example uses the eventSubscription query to get the details of a subscription with the specified subscriptionId.

Request
// GraphQL query
query  {
  eventSubscription(subscriptionId:"example-subscription-id") {
    subscriptionId
    eventSubscriptionDetails {
      destination {
        __typename
        ... on EventBridgeData {
          arn
        }
      }
      eventType
    }
    targetId
  }
}
Response
{
  "data": {
    "eventSubscription": {
      "subscriptionId": "example-subscription-id",
      "eventSubscriptionDetails": {
        "destination": {
          "__typename": "EventBridgeData",
          "arn": "arn:aws:events:us-east-1::event-source/aws.partner/buywithprime/example-event-source"
        },
        "eventType": "REFUND_REQUESTED"
      },
      "targetId": "example-target-id"
    }
  }
}

List event subscriptions

The following example uses the eventSubscriptions query to find the subscriptions you have created. The response lists all of the subscription IDs. If you then want more information about a particular subscription, you can get an event subscription.

Request
// GraphQL query

query{
  eventSubscriptions{
    edges{    
      node{     
        id
      }
    }
    totalCount
  }
}
Response
{
  "data": {
    "eventSubscriptions": {
      "edges": [
        {
          "node": {
            "id": "example-subscription-id-1"
          }
        },
        {
          "node": {
            "id": "example-subscription-id-2"
          }
        },
        {
          "node": {
            "id": "example-subscription-id-3"
          }
        }
      ],
      "totalCount": 3
    }
  }
}

Related topics