Setting up APIs
JavaScript
Create a Webhook
Create a new webhook with thecreateWebhook
mutation. You can subscribe to receive updates on multiple brands on a single webhook.
JavaScript
Retrieve a brand
We need to retrieve the brand to get it’s URN (ID). Typically you’ll have already made an initial request to fetched a brand — and now you want to continue to receive updates on it.JavaScript
Subscribe to brand updates
To subscribe to a brand’s data updates, we can use theaddWebhookSubscriptions
mutation to add the brand to the list of active subscriptions on the webhook. We can subscribe to one or more brands at once with this mutation by passing the each brand’s URN in the subscriptions
list variable.
JavaScript
Unsubscribe a subscription
If we later wish to unsubscribe from a brand we can do so with theremoveWebhookSubscriptions
mutation. Like the addWebhookSubscriptions
mutation, here we can remove multiple URNs at once by providing them as part of the subscriptions
list variable.
JavaScript