Hook
Welcome to Hook documentation file.
What is Hook?
Hook provides custom request after transaction. Shopiroller provides event-based transaction. So, your can trigger hook after transaction.
Trigger Types
Trigger types must for define a hook.
These types for can be use GetAllTypes
endpoint.
GetAllTypes
endpoints return all event for shopiroller.
METHOD : GET
ENDPOINTS : /hooks/types
Authorization : Bearer xxx
Response
{
"success": true,
"data": [
"brand.created",
"brand.updated",
"brand.deleted",
"category.created",
"category.updated",
"category.deleted",
"coupon.created",
"coupon.updated",
"coupon.deleted",
"coupon.limit.increased",
"coupon.limit.decreased",
"order.completed",
"order.payment.confirmed",
"order.payment.failured",
"order.created",
"order.product.refunded",
"order.status.changed",
"order.updated",
"product.created",
"product.updated",
"product.deleted",
"product.variant.created",
"product.variant.updated",
"shoppingcart.product.added",
"shoppingcart.cleared",
"shoppingcart.product.removed",
"shoppingcart.updated",
"shoppingcart.coupon.applied",
"shoppingcart.coupon.discarded"
]
}
Define a Hook
These fields mandatory for define a hook.
- type (for example; brand.created, category.updated)
- name (name of hook; Brand Created Trigger)
- Requests (hook requests)
METHOD : POST
Authorization : Bearer xxx
ENDPOINT : /hooks/apps/ -- DefineHook
Request
{
"type": "category.created",
"name": "Create Category",
"requests": [
{
"url": "https://eoorgdth9v3lzq3.m.pipedream.net",
"maxRetryCount": 1,
"method": "POST",
"headers": [
{
"name": "Authorization",
"value": "Bearer xxx"
}
]
}
]
}
Note Headers field not mandatory.
Response
{
"success": true,
"data": {
"id": "87806046-4645-4c22-92ab-58a2cc637672",
"key": "category.created",
"name": "Create Category",
"tenantId": "6df9194e-5718-4226-8ff8-84002f90136a",
"requests": [
{
"id": "73a9f773-cd28-46ff-a630-5bca22818555",
"url": "https://eoorgdth9v3lzq3.m.pipedream.net",
"maxRetryCount": 1,
"method": "POST",
"headers": [
{
"name": "Authorization",
"value": "Bearer xxx"
}
]
}
]
}
}
Get All Hooks
GetAllHook
endpoint can be will uses for list pages.
Users can see definated hooks.
METHOD : GET
Authorization : Bearer xxx
ENDPOINT : /hooks/apps/
Response
{
"success": true,
"data": [
{
"id": "2f3c78a7-bd34-4a39-b4d6-e3d30aa8bba2",
"key": "brand.created",
"name": "brand hook",
"tenantId": "6df9194e-5718-4226-8ff8-84002f90136a"
},
{
"id": "4f3578a7-bd34-4a39-b4d6-e3d30aa8bb22",
"key": "product.created",
"name": "product created hook",
"tenantId": "6df9194e-5718-4226-8ff8-84002f90136a"
}
]
}
This endpoint returns only name and key properties.
You can use the GetHookRequests
endpoint for the definition of hook.
Request of Hook
This endpoint will use a hook detail page or component.
METHOD : GET
Authorization : Bearer xxx
ENDPOINT : /hooks/
Response
{
"success": true,
"data": [
{
"id": "51a84cab-69c4-4ca3-9279-70d705a28c11",
"url": "https://eoorgdth9v3lzq3.m.pipedream.net",
"maxRetryCount": 3,
"method": "POST",
"headers": [{
"name": "Authorization",
"value": "xxx"
}]
}
]
}
NOTE
Hook endpoints contain Update and Delete operations. These operations for can visit swagger documentation.