Setup a webhook and subscribe to brand updates
A quick walk through on how to fetch a brand and subscribe to receive updates using webhooks.
Setting up APIs
Create a Webhook
Create a new webhook with the createWebhook
mutation. You can subscribe to receive updates on multiple brands on a single webhook.
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.
Subscribe to brand updates
To subscribe to a brand’s data updates, we can use the addWebhookSubscriptions
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.
Unsubscribe a subscription
If we later wish to unsubscribe from a brand we can do so with the removeWebhookSubscriptions
mutation. Like the addWebhookSubscriptions
mutation, here we can remove multiple URNs at once by providing them as part of the subscriptions
list variable.