Subscriptions
Like a blockchain, Asset Register is event driven and therefore subscribers must be given real time feedback on what is happening so they can react to them.
Event
When you subscribe to an event you will receive the full transaction that includes the event you are interested in.
Webhook
Like any other webhook subscription, the Asset Register Subscription Service will forward the events via a POST request with the API_KEY
set in the headers, ensuring the origination of the request.
If an event delivery to a webhook endpoint is attempted and an error occurs, the following takes place:
Events associated with error codes 409, 429, and 5xx are retried.
Events associated with error codes 1xx, 2xx, 3xx, and 4xx (excluding 429) are not retried.
We read the standard HTTP response header Retry-After
to determine how long to wait before making a follow-up request. We then choose the more conservative value between the defined retry policy and the Retry-After
header. If Retry-After
value is negative, the event will not be retried.
Usage
You must send a valid SIWE token for the following interactions. Please see Admin Authentication.
The following mutations demonstrate the main use cases. However, additional mutations for managing endpoints are available. To explore the complete set of mutations, refer to the GraphQL playground by navigating to the GraphQL URL in your browser.
Creating a webhook endpoint
Before you can create a subscription, a webhook endpoint must be created. This will point all the subscriptions to the correct URL and will set you up with an API Key for request authentication.
The retries
property determines the number of times the webhook endpoint will be retried before stopping. The maximum allowable number of retries is set at 20.
The webhookId
from the response should be used whenCreating a subscription.
Creating a subscription
Querying subscription resources
You can use the following queries to get subscription resources created by the requester:
webhookEndpoint
webhookEndpoints
webhookSubscription
webhookSubscriptions