These events are emitted by the Inventory API (btrz-api-inventory) when stations are created or updated.
Events
| Action | Event name | Endpoint |
|---|---|---|
| Create a station | station.created | POST /stations |
| Update a station | station.updated | PUT /station/{stationId} |
The payload data object contains the full station document, including an optional customFields array when the station has custom field values. Each item in customFields has internalId (the custom field definition id for model "Stations") and value (string or null).
Payload example created
{
"attemptId": "3e25bece-6398-4adc-8aab-dccd66431b8c",
"created": 1623864385,
"data": {
"isBorder": false,
"disabled": false,
"createdAt": {
"offset": 0,
"value": "2021-06-16T17:26:24.695Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"country": "CA",
"primaryCurrencyCode": null,
"ord": 0,
"type": {
"code": "",
"name": ""
},
"address": "34 ho",
"airlines": [],
"canReceive": false,
"_id": "60ca34408b8bf3199e511e8e",
"displayedCurrencies": null,
"canSend": false,
"province": "Nunavut",
"name": "111aaaa",
"deleted": false,
"alternativeNames": [
{
"deleted": null,
"id": "b4a7e40f-67be-4967-81a9-1323ccffe481",
"name": "alt1"
},
{
"deleted": null,
"id": "c78c0f63-b2c1-476e-bec7-d388af58ea97",
"name": "alt2"
}
],
"connex": {
"waitingTimes": {
"max": 0,
"min": 0,
"override": false
}
},
"updatedAt": {
"offset": 0,
"value": "2021-06-16T17:26:24.695Z"
},
"longitude": "-54.000",
"details": "111aaaa",
"city": "toy",
"timeZone": "America/Toronto",
"shipTrackClientId": "",
"zone": "2",
"latitude": "12.890",
"acceptedCurrencies": null,
"timeZoneDiff": 0,
"stationsGroupedWithThisStation": [],
"excludeFromConnex": true,
"accountId": "52a377ec430c7d4e220001fc",
"zip": "Z1Z 1Z1",
"stationsInGroupAreBoarding": false,
"terminals": [],
"shortcode": "TST",
"forceShiftDeposits": {},
"institutionCodes": [],
"hideWhenPrintingManifest": false,
"locationPurchaseLimits": {},
"isCountryCustom": false,
"operatingCompanyId": "5d94b5289a70a63c62eebf68",
"costCenter": "COST CENTER",
"operatingCompanyName": "test operating company",
"seriesNumber": "10",
"externalId": "T1",
"borderCode": "",
"GTFSData": [],
"customFields": [
{ "internalId": "507f1f77bcf86cd799439011", "value": "some value" },
{ "internalId": "507f1f77bcf86cd799439012", "value": "on" }
]
},
"event": "station.created",
"id": "55d5a792-9b0a-4daf-8fc7-63bf070689c1",
"livemode": true
}
Field descriptions — data (station.created / station.updated)
| Field | Type | Description |
|---|---|---|
| _id | string | Station id (24 hex characters). |
| accountId | string | Account (provider) id. |
| name | string | Station name. |
| shortcode | string | Short code for the station (unique per account). |
| externalId | string | Id of the station in the external system. |
| type | object | Station type: code, name. |
| details | string | Station details/description. |
| zone | string | Zone of the station. |
| latitude | string | Latitude. |
| longitude | string | Longitude. |
| timeZone | string | IANA time zone. |
| timeZoneDiff | number | Time zone offset. |
| disabled | boolean | Whether the station is disabled. |
| deleted | boolean | Whether the station is soft-deleted. |
| ord | number | Sort order. |
| address | string | Street address. |
| province | string | Province/state. |
| city | string | City. |
| zip | string | Postal/zip code. |
| country | string | Country code. |
| canSend | boolean | Whether the station can send (e.g. parcels). |
| canReceive | boolean | Whether the station can receive. |
| alternativeNames | array | Alternative names; items may have id, name, deleted. |
| stationsGroupedWithThisStation | array | Station ids grouped with this one. |
| acceptedCurrencies | array | Accepted currency codes. |
| displayedCurrencies | array | Currencies to display. |
| primaryCurrencyCode | string | Primary currency code. |
| operatingCompanyId | string | Operating company id (24 hex). |
| operatingCompanyName | string | Operating company name. |
| stationClassId | string | Station class id. |
| stationClassName | string | Station class name. |
| lexiconKeys | object | Lexicon keys for name/details. |
| customFields | array | Custom field values: { internalId, value }. |
| createdAt | object | BzDate: when the station was created. |
| updatedAt | object | BzDate: when the station was last updated. |
| userId | string | User id that created the resource. |
Payload example updated
{
"attemptId": "b50655f0-2ef4-4b1b-8264-48d733cf3bac",
"created": 1623864436,
"data": {
"isBorder": false,
"disabled": false,
"createdAt": {
"offset": 0,
"value": "2021-06-16T17:26:24.695Z"
},
"userId": "55fc2f318791db6e1a0000b6",
"country": "CA",
"primaryCurrencyCode": null,
"ord": 0,
"type": {
"code": "",
"name": ""
},
"address": "34 ho",
"airlines": [],
"canReceive": false,
"_id": "60ca34408b8bf3199e511e8e",
"displayedCurrencies": null,
"canSend": false,
"province": "Nunavut",
"name": "111aaaa",
"deleted": false,
"alternativeNames": [
{
"deleted": null,
"id": "b4a7e40f-67be-4967-81a9-1323ccffe481",
"name": "alt1"
},
{
"deleted": null,
"id": "c78c0f63-b2c1-476e-bec7-d388af58ea97",
"name": "alt2"
}
],
"connex": {
"waitingTimes": {
"max": 0,
"min": 0,
"override": false
}
},
"updatedAt": {
"offset": 0,
"value": "2021-06-16T17:26:38.143Z"
},
"longitude": "-54.000",
"details": "desc",
"city": "toy",
"timeZone": "America/Toronto",
"shipTrackClientId": "",
"zone": "2",
"latitude": "12.890",
"acceptedCurrencies": null,
"timeZoneDiff": 0,
"stationsGroupedWithThisStation": [],
"excludeFromConnex": true,
"accountId": "52a377ec430c7d4e220001fc",
"zip": "Z1Z 1Z1",
"stationsInGroupAreBoarding": false,
"terminals": [],
"shortcode": "TST",
"forceShiftDeposits": {},
"institutionCodes": [],
"hideWhenPrintingManifest": false,
"locationPurchaseLimits": {},
"isCountryCustom": false,
"operatingCompanyId": "5d94b5289a70a63c62eebf68",
"costCenter": "COST CENTER",
"operatingCompanyName": "test operating company",
"seriesNumber": "10",
"externalId": "T1",
"borderCode": "",
"GTFSData": [],
"customFields": [
{ "internalId": "507f1f77bcf86cd799439011", "value": "some value" },
{ "internalId": "507f1f77bcf86cd799439012", "value": null }
]
},
"event": "station.updated",
"id": "0dbaa21f-dbdc-444e-8b50-1080b5f18a90",
"livemode": true
}
(Field descriptions for data are the same as for station.created above.)