These events are emitted by the Inventory API (btrz-api-inventory) when segment information is created, updated, or deleted.
Events
| Action |
Event name |
Endpoint |
| Create segment information |
segmentsinformation.created |
POST /segments-information |
| Update segment information |
segmentsinformation.updated |
PUT /segments-information/:segmentInformationId |
| Delete segment information |
segmentsinformation.deleted |
DELETE /segments-information/:segmentInformationId |
Create payload example
{
"attemptId": "aefbeb59-4fb1-47f9-b218-72bd657a72de",
"created": 1689112634,
"data": {
"_id": "64add0369c37010453c0ac61",
"accountId": "52a377ec430c7d4e220001fc",
"biDirectional": false,
"createdAt": {
"offset": 0,
"value": "2023-07-11T21:57:10.818Z"
},
"createdBy": "55fc2f318791db6e1a0000b6",
"destination": "Cordoba",
"destinationId": "64a5b3a6f7e9f9052a32b679",
"distance": 230,
"duration": 12,
"origin": "Cheat Bridge",
"originId": "57a4d221be7c885047adad6c",
"updatedAt": {
"offset": 0,
"value": "2023-07-11T21:57:10.819Z"
},
"updatedBy": "55fc2f318791db6e1a0000b6"
},
"event": "segmentsinformation.created",
"id": "f17b6196-ca3e-4302-bfce-ffda71565329",
"livemode": true
}
Update payload example
{
"attemptId": "09aa530e-828c-466c-a9df-8388b3977fe9",
"created": 1689112457,
"data": {
"_id": "64adc378a4ae3e0429934016",
"accountId": "52a377ec430c7d4e220001fc",
"biDirectional": true,
"createdAt": {
"offset": 0,
"value": "2023-07-11T21:02:48.586Z"
},
"createdBy": "55fc2f318791db6e1a0000b6",
"destination": "Cordoba",
"destinationId": "64a5b3a6f7e9f9052a32b679",
"distance": 134,
"duration": 34,
"origin": "Elkins",
"originId": "57a4d216a0d3854b47628235",
"updatedAt": {
"offset": 0,
"value": "2023-07-11T21:54:15.527Z"
},
"updatedBy": "55fc2f318791db6e1a0000b6"
},
"event": "segmentsinformation.updated",
"id": "ed718a26-f7e4-44b2-a831-ef571fd9a76d",
"livemode": true
}
Delete payload example
{
"attemptId": "998e9386-c0fe-4eb4-bed5-777f69edcc05",
"created": 1689112463,
"data": {
"segmentInformationId": "64adc378a4ae3e0429934016"
},
"event": "segmentsinformation.deleted",
"id": "151179e7-7919-402f-8a64-6ba284f702c9",
"livemode": true
}
| Field |
Type |
Description |
| attemptId |
string |
UUID of the attempt that triggered the event. |
| created |
number |
Unix timestamp when the event was created. |
| event |
string |
Event name (segmentsinformation.created, segmentsinformation.updated, segmentsinformation.deleted). |
| id |
string |
UUID of the webhook event. |
| livemode |
boolean |
Whether the event occurred in live mode. |
| data._id |
string |
Segment information id (24 hex characters). |
| data.accountId |
string |
Account id the segment belongs to. |
| data.originId |
string |
Origin station id (24 hex). |
| data.destinationId |
string |
Destination station id (24 hex). |
| data.origin |
string |
Origin station name. |
| data.destination |
string |
Destination station name. |
| data.distance |
integer |
Distance of the segment. |
| data.duration |
integer |
Duration of the segment in minutes. |
| data.durationHHMM |
string |
Duration in HH:MM format (e.g. "02:30"). |
| data.biDirectional |
boolean |
Whether the segment is bidirectional. |
| data.travelRouteId |
string |
Travel route id (24 hex), if set. |
| data.travelRoute |
string |
Travel route name, if set. |
| data.amenityGroupId |
string |
Amenity group id (24 hex), if set. |
| data.amenityGroup |
string |
Amenity group name, if set. |
| data.createdBy |
string |
User id that created this resource (24 hex). |
| data.updatedBy |
string |
User id that last updated this resource (24 hex). |
| data.createdAt |
object |
BzDate: creation date. |
| data.updatedAt |
object |
BzDate: last update date. |
| data.segmentInformationId |
string |
Segment information id (segmentsinformation.deleted only). |