Routes

Routes

These events are emitted by the Inventory API (btrz-api-inventory) when routes are created, updated, or deleted. Updating fare tables or proration tables for a route also emits route.updated.

Events

Action Event name Endpoint
Create a new route route.created POST /routes
Update an existing route route.updated PUT /routes/:routeId
Update fare tables route.updated PUT /routes/:routeId/fare-tables (and related)
Update proration tables route.updated PUT /routes/:routeId/proration-tables (and related)
Delete an existing route route.deleted DELETE /routes/:routeId

Payload example created

{
  "attemptId": "089ac8ec-cbc0-4f87-b642-0daf315eabe6",
  "created": 1623859525,
  "data": {
    "_id": "60ca212110e7dd421be4a3be",
    "accountId": "52a377ec430c7d4e220001fc",
    "buckets": [],
    "createdAt": {
      "offset": 0,
      "value": "2021-06-16T16:04:49.468Z"
    },
    "deleted": false,
    "disabled": false,
    "name": "New route",
    "productIds": [
      "52a377ec430c7d4e220001fe"
    ],
    "productType": "reservation",
    "stopsIds": [
      "52a378c1430c7d4e2200020c",
      "52a378c8430c7d4e2200020e"
    ],
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-16T16:04:49.479Z"
    },
    "userId": "55fc2f318791db6e1a0000b6"
  },
  "event": "route.created",
  "id": "5c44783a-ce47-4609-963f-24a9b2ffd076",
  "livemode": false
}

Payload example updated

{
  "attemptId": "5d579b39-be58-4c59-80bc-899495edf4a3",
  "created": 1623863499,
  "data": {
    "_id": "60ca30960e4ae43f897986cc",
    "accountId": "52a377ec430c7d4e220001fc",
    "buckets": [],
    "createdAt": {
      "offset": 0,
      "value": "2021-06-16T17:10:46.865Z"
    },
    "deleted": false,
    "disabled": false,
    "name": "new again",
    "productIds": [
      "52a377ec430c7d4e220001fe"
    ],
    "productType": "reservation",
    "stopsIds": [
      "52a378c1430c7d4e2200020c",
      "57a4d221be7c885047adad6c",
      "5baa97db4e474ac72ecfc225"
    ],
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-16T17:11:34.135Z"
    },
    "userId": "55fc2f318791db6e1a0000b6"
  },
  "event": "route.updated",
  "id": "4f1ee4d1-b84f-4846-8313-7925c0442940",
  "livemode": true
}

Payload for deleted

{
  "attemptId": "7484dd96-adf5-432c-855f-89c317e84882",
  "created": 1623863559,
  "data": {
    "_id": "60ca30960e4ae43f897986cc",
    "accountId": "52a377ec430c7d4e220001fc",
    "buckets": [],
    "createdAt": {
      "offset": 0,
      "value": "2021-06-16T17:10:46.865Z"
    },
    "deleted": false,
    "disabled": false,
    "name": "new again",
    "productIds": [
      "52a377ec430c7d4e220001fe"
    ],
    "productType": "reservation",
    "stopsIds": [
      "52a378c1430c7d4e2200020c",
      "57a4d221be7c885047adad6c",
      "5baa97db4e474ac72ecfc225"
    ],
    "updatedAt": {
      "offset": 0,
      "value": "2021-06-16T17:12:30.873Z"
    },
    "userId": "55fc2f318791db6e1a0000b6"
  },
  "event": "route.deleted",
  "id": "30b05444-ad6f-4b32-b0ac-de384030f336",
  "livemode": true
}

Field descriptions — payload (route events)

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 (e.g. route.created, route.updated, route.deleted).
id string UUID of the webhook event.
livemode boolean Whether the event occurred in live mode.
data._id string Route id (24 hex characters).
data.accountId string Account (provider) id.
data.name string Route name.
data.stopsIds array of string Station IDs that define the route stops.
data.productIds array of string Product IDs associated with the route.
data.productType string e.g. "reservation".
data.garagesIds array of string Optional; garage IDs.
data.buckets array Fare/price buckets.
data.deleted boolean Soft-delete flag.
data.disabled boolean Whether the route is disabled.
data.createdAt object BzDate: creation date.
data.updatedAt object BzDate: last update date.
data.userId string User id that performed the action (24 hex).