List Station Trains
Returns the trains arriving at and departing from one or more of your stations during a time window: timetable trains from bookings, and inbound interchange trains reported by other railroads. Each train has its direction, its time at the station, its car count, weight and length, and a key that identifies it across pages and calls.
Stations and window: station_grouping_ids lists up to 200 station ids (a station’s numeric legacyGroupingId in Get Network Hierarchy). Each must be an active station you can see. window_start and window_end bound the train times, end exclusive.
Paging: set page.page_size (at most 100) and follow page.next_token until it is empty; send the same stations, window and sources with each token. A paged window can be up to 31 days. Without a page size you may ask for one station and at most 24 hours. Each page reads the data as it stands when it is read, so a train retimed during a walk can be missed or listed twice: de-duplicate by key. A page can hold fewer trains than page_size and still have a next token.
Errors: a paged call answers FAILED_PRECONDITION while paging is not yet enabled for your railroad; make an unpaged one-station call instead. A paged call answers UNAVAILABLE when a source fails; retry the same page with the same token. An unpaged call instead returns the other sources’ trains and names the failed source in unavailable_sources, unless every source that ran failed, which is an error.
Permissions: with inventoryManagement.trainWorkOrders.list, a timetable train linked to a Trains & Jobs work order carries it in work_order; pass the work_order.work_order_id values to List Work Orders (workOrderIds) for the full work orders. With inventoryManagement.consist.list, interchange trains are listed. A caller without either permission gets fewer trains or fields, not an error.
Body
The stations and time window to list trains for, with forward paging.
The stations and time window to list trains for, with forward paging.
Which kinds of train to list: STATION_TRAIN_SOURCE_TRIP_PLAN (timetable trains from bookings) and STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST (inbound interchange trains). Empty means both; any other value is INVALID_ARGUMENT. A source you lack permission for lists nothing; it is not an error.
STATION_TRAIN_SOURCE_UNSPECIFIED, STATION_TRAIN_SOURCE_TRIP_PLAN, STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST, STATION_TRAIN_SOURCE_WORK_ORDER Response
A successful response.
Unpaged requests only: requested sources that failed and contributed no trains. A paged request whose source fails answers UNAVAILABLE instead; retry the page with the same token.
STATION_TRAIN_SOURCE_UNSPECIFIED, STATION_TRAIN_SOURCE_TRIP_PLAN, STATION_TRAIN_SOURCE_INTERCHANGE_CONSIST, STATION_TRAIN_SOURCE_WORK_ORDER