Holidays (Inventory API)
These events are emitted by the Inventory API when holidays are created, updated, or deleted (POST/PUT/DELETE on /holidays).
Events
| Action | Event name | Endpoint |
|---|---|---|
| Create a new holiday | holiday.created |
POST /holidays |
| Update an existing holiday | holiday.updated |
PUT /holidays/:holidayId |
| Delete an existing holiday | holiday.deleted |
DELETE /holidays/:holidayId |
Payload example – created
{
"attemptId": "92814c89-0523-4850-91f2-59f56d307da0",
"created": 1623794313,
"data": {
"_id": "60c92280d9e6c43f77b5a583",
"accountId": "52a377ec430c7d4e220001fc",
"blackout": false,
"createdAt": {
"offset": 0,
"value": "2021-06-15T21:58:24.501Z"
},
"date": {
"offset": 0,
"value": "2021-12-24T00:00:00.000Z"
},
"day": 24,
"deleted": false,
"month": 12,
"name": "Christmas eve",
"recurring": true,
"updatedAt": {
"offset": 0,
"value": "2021-06-15T21:58:24.519Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"year": 2021
},
"event": "holiday.created",
"id": "0d0db269-657a-4262-a39b-8dad900656d6",
"livemode": true
}
Field descriptions – data (created / updated)
| Field | Type | Description |
|---|---|---|
| _id | string | Holiday id (24 hex characters). |
| accountId | string | Account id this holiday belongs to. |
| date | object | BzDate – the date of the holiday. |
| day | number | Day of the month (1–31). |
| month | number | Month of the year (1–12). |
| year | number | Year (1970–3000). |
| name | string | Name of the holiday. |
| blackout | boolean | If true, this holiday is a blackout. |
| recurring | boolean | If true, this holiday recurs every year. |
| externalId | string | Id of this entity in an external system. |
| createdBy | string | User id that created the resource. |
| updatedBy | string | User id that last updated the resource. |
| createdAt | object | BzDate – creation date. |
| updatedAt | object | BzDate – last update date. |
Payload example – updated
{
"attemptId": "50a1e4e9-f82f-451d-a706-7bb09a73253f",
"created": 1623794314,
"data": {
"_id": "60c92280d9e6c43f77b5a583",
"accountId": "52a377ec430c7d4e220001fc",
"blackout": false,
"createdAt": {
"offset": 0,
"value": "2021-06-15T21:58:24.501Z"
},
"date": {
"offset": 0,
"value": "2021-12-24T00:00:00.000Z"
},
"day": 24,
"deleted": false,
"month": 12,
"name": "Christmas eve",
"recurring": true,
"updatedAt": {
"offset": 0,
"value": "2021-06-15T21:58:29.963Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"year": 2021
},
"event": "holiday.updated",
"id": "da2d0382-ae42-4e24-b7ec-8bbe06996e2c",
"livemode": true
}
(Field descriptions for data are the same as for created.)
Payload example – deleted
The data object for holiday.deleted contains only the id of the deleted holiday.
{
"attemptId": "d454ab80-ae4a-4afa-91d1-4c833c7814ca",
"created": 1623794318,
"data": {
"holidayId": "60c92280d9e6c43f77b5a583"
},
"event": "holiday.deleted",
"id": "dd2debe2-e8c8-4414-a4f6-5a7e8badb4f6",
"livemode": true
}
Field descriptions – data (deleted)
| Field | Type | Description |
|---|---|---|
| holidayId | string | Id of the deleted holiday (24 hex characters). |