You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/api/client.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,51 @@ Client errors include a unique code number, error message and original thrown er
84
84
}
85
85
```
86
86
87
+
## Webhooks
88
+
89
+
Client uses webhooks for event notifications. Webhooks are HTTP callbacks that receive notification messages for occurred events. You can set up your account's webhook and subscribe to different events with function [updateAccountWebhook(url, events)](client.html#updateaccountwebhook-url-events). Webhooks will be sent to your chosen URL with a HTTP method `POST`, so your webhook handler should be configured properly.
90
+
91
+
### Events
92
+
93
+
Webhook events are triggered when either Order request, Approve request or Deployment request is changed. Client supports six different kind of events based on changes in Order / Deployment / Approve requests.
94
+
95
+
| Event kind | Description
96
+
|-|-
97
+
| 0 | Order request changed - Event triggers when Order object changes during processing.
98
+
| 1 | Order request error - Event triggers when an error occurs during processing of the Order.
99
+
| 2 | Deployment request changed - Event triggers when Deployment object changes during processing.
100
+
| 3 | Deployment request error - Event triggers when an error occurs during processing of the Deployment.
101
+
| 4 | Approve request changed - Event triggers when Approve request object changes during processing.
102
+
| 5 | Approve request error - Event triggers when an error occurs during processing of the Approve request.
103
+
104
+
### Webhook response body
105
+
106
+
Webhook response body includes three important parameters:
107
+
108
+
| Parameter | Description
109
+
|-|-
110
+
| requestRef | A `string` representing either Order request, Approve request or Deployment request reference.
111
+
| requestKind | A `integer` representing the kind of the request on which errors or changes occurred. Can be one of the [Request kinds](client.html#request-kinds).
112
+
| kind | A `integer` representing the kind of the event that occurred. Event kinds can be found in previous chapter [Events](client.html#events).
113
+
114
+
##### Request kinds
115
+
116
+
| Number | Description
117
+
|-|-
118
+
| 0 | Order request.
119
+
| 1 | Deployment request.
120
+
| 2 | Approve request.
121
+
122
+
With these parameters we can determine which of our requests was changed. Based on the `requestKind` we can decide which function should we use for obtaining our changed request. We provide `requestRef` from received webhook, to our getter function.
123
+
124
+
| Request kind | Function for obtaining request object
| 400014 | Account is not identified. Before you start using API on Ethereum mainnet you must provide information about yourself using update account route.
194
239
240
+
You can learn more about webhooks in chapter [Webhooks](client.html#webhooks).
241
+
195
242
## updateAccountWebhook(url, events)
196
243
197
244
An `asynchronous` class instance `function` which updates currently authenticated account's webhook data.
@@ -211,6 +258,8 @@ An `asynchronous` class instance `function` which updates currently authenticate
0 commit comments