Skip to content

Commit 77a6720

Browse files
authored
Moved subscriptions.md up to the root and divided it into concept/eve… (iZettle#139)
* Moved subscriptions.md up to the root and divided it into concept/event-payloads.md and overview.md. Fixed cross-reference links. * Changed absolute paths to relevant paths in links.
1 parent 92bd4d5 commit 77a6720

File tree

5 files changed

+52
-49
lines changed

5 files changed

+52
-49
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Currently, Zettle provides APIs for the following markets:
2929
- [Product Library](product-library.adoc)
3030
- [Inventory](inventory.md)
3131
- [Image](image.md)
32-
- [Pusher](pusher-api/)
32+
- [Pusher](pusher-api/overview.md)
3333
- [Giftcard](giftcard.md)
3434

3535
All API changes are recorded in [Changelog](CHANGELOG.adoc).

pusher-api/api-reference.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ To create or update a subscription to an event, you will need to be authorized w
4545

4646
E.g. you will require the `READ:PURCHASE` scope if you want to subscribe to the `PurchaseCreated` event. See [the list of scopes for supported events](#supported-events).
4747

48-
For more information on how to get authorization for a particular scope, see [OAuth2 API](https://github.com/iZettle/api-documentation/blob/master/authorization.md).
48+
For more information on how to get authorization for a particular scope, see [OAuth2 API](../authorization.md).
4949

5050
## Create a subscription
5151

5252
Creates a webhook subscription to a specific event.
5353

5454
Once the subscription for an event gets created, the Pusher API will publish data on your service whenever that event occurs.
5555

56-
E.g. You created a subscription for the ProductUpdated event. Whenever a product gets updated in the product library, the ProductUpdated event occurs. Then you will receive event data on the destination server that you have exposed publicly. The event data is a payload for the updated product. See the list of [payloads for all events](user-guides/subscriptions.md#payloadAPITable).
56+
E.g. You created a subscription for the ProductUpdated event. Whenever a product gets updated in the product library, the ProductUpdated event occurs. Then you will receive event data on the destination server that you have exposed publicly. The event data is a payload for the updated product. See the list of [payloads for all events](concept/event-payloads.md#available-event-payloads).
5757

5858
> **Note:** The Pusher API will push data for an event only once. However, there may be cases where it gets published more than once. You don't need to save the data more than once.
5959
@@ -71,7 +71,7 @@ See example [Create a webhook subscription](#create-a-webhook-subscription).
7171

7272
|Name |Type |In |Required/Optional |Description
7373
|---- |---- |---- |---- |----
74-
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li>Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](https://github.com/iZettle/api-documentation/blob/master/authorization.md) .</li></ul>
74+
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li>Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](../authorization.md).</li></ul>
7575
|uuid |string |query |required | Unique identifier for the subscription as UUID version 1.
7676
|transportName |string |query |required | The message option used by Pusher API. Currently only `WEBHOOK` is supported.
7777
|eventNames |array |query |required | Event names for events that you want to create subscription for. The events are specified in an array. <br/>If you pass an empty array, you will subscribe to all events that the Pusher API supports. In this case, make sure that you have all the corresponding authorization scopes issued. See [the list of scopes](#supported-events).
@@ -127,7 +127,7 @@ See example [Get webhook subscriptions](#get-webhook-subscriptions).
127127

128128
|Name |Type |In |Required/Optional |Description
129129
|---- |---- |---- |---- |----
130-
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](https://github.com/iZettle/api-documentation/blob/master/authorization.md) .</li></ul>
130+
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](../authorization.md).</li></ul>
131131
</details>
132132

133133

@@ -178,7 +178,7 @@ See example [Update a webhook subscription](#update-a-webhook-subscription).
178178

179179
|Name |Type |In |Required/Optional |Description
180180
|---- |---- |---- |---- |----
181-
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](https://github.com/iZettle/api-documentation/blob/master/authorization.md) .</li></ul>
181+
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](../authorization.md).</li></ul>
182182
|subscriptionUuid |string |path |required |Unique identifier for an existing subscription as UUID version 1.
183183
|transportName |string |query |optional | The message option used by the Pusher API. E.g. `WEBHOOK`. You need to specify the same option that you used while creating the subscription.
184184
|eventNames |array |query |optional | Events that you want to update on the existing subscription. The events are specified in an array.
@@ -225,7 +225,7 @@ See example [Delete a webhook subscription](#delete-a-webhook-subscription).
225225

226226
|Name |Type |In |Required/Optional |Description
227227
|---- |---- |---- |---- |----
228-
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](https://github.com/iZettle/api-documentation/blob/master/authorization.md) .</li></ul>
228+
|organizationUuid |string |path |required |Unique identifier for your organization. You can use following options to fill in this value: <br/><ul><li>Use `self` as the value. This will retrieve your organizationUuid from the authentication token in the request.</li><li> Get it by using the `users/me` endpoint of OAuth2 API. For more information, see [OAuth2 API](../authorization.md).</li></ul>
229229
|subscriptionUuid |string |path |required |Unique identifier for an existing subscription as UUID version 1.
230230
</details>
231231

@@ -394,7 +394,7 @@ Response
394394

395395

396396
## Related resources
397-
[Pusher API user guide](user-guides/subscriptions.md)
397+
[Pusher API user guide](user-guides)
398398

399399
## Related API reference
400400
[OAuth2 API Reference](../authorization.md)

pusher-api/user-guides/subscriptions.md renamed to pusher-api/concept/event-payloads.md

+8-40
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
Subscriptions
1+
Event payloads
22
=====================
3-
With subscriptions, the Pusher API will immediately update you of those events that are triggered on your Zettle Go. So you don't need to pull information from other Zettle Go APIs.
3+
When an event of your subscription is triggerd, the Pusher API sends `POST` requests with the `payload` field.
44

5-
* [Understand how events work](#understand-how-events-work)
6-
* [Payloads](#payloads)
7-
* [Plan subscriptions](#plan-subscriptions)
8-
* [Manage subscriptions](#manage-subscriptions)
9-
10-
## Understand how events work
11-
The Pusher API provides events for you to listen to certain activities of the Zettle Go app at a working HTTPS endpoint on your server.
12-
13-
After you subscribe to events, when an event is triggered, the Pusher API sends a `POST` request that contains a `payload` field. The field contains event information to the HTTPS endpoint in real time.
14-
15-
### Payloads
16-
The `payload` field is the response body from other APIs, such as the Inventory API. The Pusher API sends `POST` requests with the `payload` field in the following JSON format:
5+
The `payload` field is the response body from other APIs, such as the Inventory API. The field contains event information to the HTTPS endpoint in real time.
6+
7+
The `payload` field is in the following JSON format:
178

189
```json
1910
{
@@ -39,8 +30,10 @@ For example, you have a subscription to the `InventoryTrackingStarted` event. Wh
3930
"timestamp": "2021-04-19T13:17:56.585Z"
4031
}
4132
```
33+
## Available event payloads
34+
The following table lists available event payloads.
4235

43-
For more information on event payloads, see the following table.
36+
> **Note:** As payloads can be updated due to changes of the APIs that provide payloads, you can ignore unknown fields.
4437
4538
<table name="payloadAPITable">
4639
<thead>
@@ -231,28 +224,3 @@ For more information on event payloads, see the following table.
231224
</td>
232225
</tbody>
233226
</table>
234-
235-
<!-- Ask the team: are the payloads for ApplicationConnectionRemoved, PersonalAssertionDeleted, OrganizationUpdated, and OrganizationFeatureUpdated from the Pusher API? -->
236-
> **Note:** As payloads can be updated due to changes of the APIs that provide payloads, you can ignore unknown fields.
237-
238-
239-
## Plan subscriptions
240-
Before subscribing to events, plan which events to use for your use cases.
241-
242-
To get started, you may want to subscribe to the following events:
243-
244-
* To monitor inventory changes in Zettle Point of Sales (POS): `InventoryBalanceChanged`, `InventoryTrackingStarted`, and `InventoryTrackingStopped`
245-
* To monitor product library changes: `ProductCreated`, `ProductUpdated`, and `ProductDeleted`
246-
* To monitor purchases: `PurchaseCreated`
247-
<!-- We can extend this section to be more focused on use cases later on. -->
248-
249-
For more events that you can subscribe, see [Pusher API reference](../api-reference.md).
250-
251-
## Manage subscriptions
252-
With the Pusher API, you can create, view, update, and delete subscriptions as you need.
253-
254-
* [Create subscriptions](create-subscriptions.md)
255-
* [View subscriptions](view-subscriptions.md)
256-
* [Update subscriptions](update-subscriptions.md)
257-
* [Delete subscriptions](delete-subscriptions.md)
258-

pusher-api/overview.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Pusher API overview
2+
=====================
3+
With subscriptions, the Pusher API will immediately update you of those events that are triggered on your Zettle Go. So you don't need to pull information from other Zettle Go APIs.
4+
5+
* [Understand how subscriptions work](#understand-how-subscriptions-work)
6+
* [Plan subscriptions](#plan-subscriptions)
7+
* [Manage subscriptions](#manage-subscriptions)
8+
9+
## Understand how subscriptions work
10+
The Pusher API provides events for you to listen to certain activities of the Zettle Go app at a working HTTPS endpoint on your server.
11+
12+
After you subscribe to events, when an event is triggered, the Pusher API sends a `POST` request that contains a `payload` field. The field contains event information to the HTTPS endpoint in real time.
13+
14+
For more information about event payloads, see [event payloads](concept/event-payloads.md).
15+
16+
## Plan subscriptions
17+
Before subscribing to events, plan which events to use for your use cases.
18+
19+
To get started, you may want to subscribe to the following events:
20+
21+
* To monitor inventory changes in Zettle Point of Sales (POS): `InventoryBalanceChanged`, `InventoryTrackingStarted`, and `InventoryTrackingStopped`
22+
* To monitor product library changes: `ProductCreated`, `ProductUpdated`, and `ProductDeleted`
23+
* To monitor purchases: `PurchaseCreated`
24+
<!-- We can extend this section to be more focused on use cases later on. -->
25+
26+
For more events that you can subscribe, see [Pusher API reference](api-reference.md).
27+
28+
## Manage subscriptions
29+
With the Pusher API, you can create, view, update, and delete subscriptions as you need.
30+
31+
* [Create subscriptions](user-guides/create-subscriptions.md)
32+
* [View subscriptions](user-guides/view-subscriptions.md)
33+
* [Update subscriptions](user-guides/update-subscriptions.md)
34+
* [Delete subscriptions](user-guides/delete-subscriptions.md)
35+

pusher-api/user-guides/create-subscriptions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Subscribe to events to stay updated of activities that happen on your Zettle Go
1212

1313
## Prerequisites
1414
* Make sure that authorization is set up using [Authorization OAuth2 API](../../authorization.md).
15-
* Make sure that you have set up an HTTPS endpoint as the destination URL on your server for receiving event notifications. The endpoint must be publicly accessible and correctly process event payloads. For events payloads, see [Payloads](subscriptions.md/#payloads).
15+
* Make sure that you have set up an HTTPS endpoint as the destination URL on your server for receiving event notifications. The endpoint must be publicly accessible and correctly process event payloads. See [event payloads](concept/event-payloads.md).
1616
* Make sure that you understand the events that are supported by the Pusher API. For events that are supported by the Pusher API, see [Pusher API reference](../api-reference.md#supported-events).
1717
<!-- to be continued if any -->
1818

0 commit comments

Comments
 (0)