For example, you can rely on webhooks to trigger an action in your app when a customer creates a new order or shirtplatform fulfills an order.
By using webhooks subscriptions you can make fewer API calls overall, which makes sure that your apps are more efficient and update quickly.
/accounts/{accountId}/shops/{shopId}/webhooks
Create a new webhook subscription.
The subscription's secret is required; it is used to derive the
x-shirtplatform-hmac-sha256 signature sent with every delivered event.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
shopId |
required | path | int | the unique identifier of the shop |
| Media Type | Data Type | Description |
|---|---|---|
application/json |
Webhook | the webhook subscription data. Required fields: address
(callback URL), topic (subscribed event), and secret. |
application/xml |
Webhook |
| Code | Condition |
|---|---|
| 200 | the webhook subscription was created |
| 400 | validation failed (for example, the required secret is missing) |
<webhook>
<id>...</id>
<address>https://whatever.hostname.com/</address>
<topic>orders/updated</topic>
<secret>mysecretword</secret>
<mediaType>JSON</mediaType>
</webhook>
{
"webhook" : {
"id" : 12345,
"address" : "https://whatever.hostname.com/",
"topic" : "orders/updated",
"secret" : "mysecretword",
"mediaType" : "JSON"
}
}
<webhook>
<id>...</id>
<address>https://whatever.hostname.com/</address>
<topic>orders/updated</topic>
<secret>mysecretword</secret>
<mediaType>JSON</mediaType>
</webhook>
{
"webhook" : {
"id" : 12345,
"address" : "https://whatever.hostname.com/",
"topic" : "orders/updated",
"secret" : "mysecretword",
"mediaType" : "JSON"
}
}
/accounts/{accountId}/shops/{shopId}/webhooks
Get a list of webhook subscriptions for your shop.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
shopId |
required | path | int | the unique identifier of the shop | |
filterId |
query | |
optional id of a saved Filter.Webhook; an empty string returns all subscriptions |
||
page |
query | 0 |
int | zero-based page index | |
size |
query | 10 |
int | number of items per page |
| Code | Condition |
|---|---|
| 200 | the webhook subscriptions were successfully retrieved |
<pagedData>
<records>...</records>
<totalElements>...</totalElements>
</pagedData>
{
"pagedData" : {
"records" : [ { }, { } ],
"totalElements" : 12345
}
}
/accounts/{accountId}/shops/{shopId}/webhooks/{id}
Get a single webhook by its id.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
id |
required | path | int | the unique identifier of the webhook subscription | |
shopId |
required | path | int | the unique identifier of the shop |
| Code | Condition |
|---|---|
| 200 | the webhook subscription was successfully retrieved |
| 404 | no webhook subscription exists for the given id in the shop |
<webhook>
<id>...</id>
<address>https://whatever.hostname.com/</address>
<topic>orders/updated</topic>
<secret>mysecretword</secret>
<mediaType>JSON</mediaType>
</webhook>
{
"webhook" : {
"id" : 12345,
"address" : "https://whatever.hostname.com/",
"topic" : "orders/updated",
"secret" : "mysecretword",
"mediaType" : "JSON"
}
}
/accounts/{accountId}/shops/{shopId}/webhooks/{id}
Update a webhook subscription.
The id and shop in the body are ignored; the path id identifies the
subscription. Send a secret only to rotate it — an omitted secret leaves the
existing one unchanged.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
id |
required | path | int | the unique identifier of the webhook subscription | |
shopId |
required | path | int | the unique identifier of the shop |
| Media Type | Data Type | Description |
|---|---|---|
application/json |
Webhook | the updated webhook subscription data |
application/xml |
Webhook |
| Code | Condition |
|---|---|
| 200 | the webhook subscription was updated |
| 404 | no webhook subscription exists for the given id in the shop |
<webhook>
<id>...</id>
<address>https://whatever.hostname.com/</address>
<topic>orders/updated</topic>
<secret>mysecretword</secret>
<mediaType>JSON</mediaType>
</webhook>
{
"webhook" : {
"id" : 12345,
"address" : "https://whatever.hostname.com/",
"topic" : "orders/updated",
"secret" : "mysecretword",
"mediaType" : "JSON"
}
}
<webhook>
<id>...</id>
<address>https://whatever.hostname.com/</address>
<topic>orders/updated</topic>
<secret>mysecretword</secret>
<mediaType>JSON</mediaType>
</webhook>
{
"webhook" : {
"id" : 12345,
"address" : "https://whatever.hostname.com/",
"topic" : "orders/updated",
"secret" : "mysecretword",
"mediaType" : "JSON"
}
}
/accounts/{accountId}/shops/{shopId}/webhooks/{id}
Delete a webhook subscription. Deleting an unknown subscription still succeeds; the operation is idempotent.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
id |
required | path | int | the unique identifier of the webhook subscription | |
shopId |
required | path | int | the unique identifier of the shop |
| Code | Condition |
|---|---|
| 204 | the webhook subscription was deleted, or did not exist |
| Media Type | Data Type | Description |
|---|---|---|
application/json |
object
|
|
application/xml |
anyType
|
/accounts/{accountId}/shops/{shopId}/webhooks/{id}/testOrderEvent/{orderId}
Test a webhook subscription by triggering its subscribed order event.
The subscription's own topic is dispatched for the given order exactly as a real
event would be, letting you verify that your endpoint receives and validates the signed
payload. No response body is returned.
| Name | In | Default | Constraints | Description | |
|---|---|---|---|---|---|
x-auth-token |
header | The authentication token | |||
accountId |
required | path | int | the unique identifier of the account | |
id |
required | path | int | the unique identifier of the webhook subscription to test | |
orderId |
required | path | int | the unique identifier of the order to use for the test event | |
shopId |
required | path | int | the unique identifier of the shop |
| Code | Condition |
|---|---|
| 204 | the test event was dispatched |
| 404 | no webhook subscription exists for the given id, or no order exists for the given orderId |
| Media Type | Data Type | Description |
|---|---|---|
application/json |
object
|
|
application/xml |
anyType
|