Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The picture below shows the TripSpecification definition in OSDM v 3.0.2. Fields marked with a red star is mandatory in OSDM. In the Samtrafiken ACCESS implementation the mandatory fields are extended to the fields marked with yellow.

For detailed information on how Samtrafiken NeTEx files ar structured see Samtrafiken NeTEx export and NeTEx format adjustments - Samtrafiken sales export.

...

start

The stop and time for the start of the the trip.

In the Samtrafiken ACCESS API, the codelist for stops will contain all Samtrafiken’s sellable national stop IDs (known as “rikshållplatser”). The stop IDs contain 9 digits and they will be used according to the codelist urn:x_swe:stn:nnnnnnnnn, where nnnnnnnnn is the stop ID.

List of stops used in Samtrafiken ACCESS:

Codelist: Stops

The timeTabledtime TimeTabledTime should be in local time

end

The stop and time for the end of the the trip.

In the Samtrafiken ACCESS API, the The stops to use in Samtrafiken ACCESS can be found in stops.xml in the daily NeTEx export from Samtrafiken.

See Codelist: Stops for more info and examples.

NeTEx - File: _stops.xml StopPlace.KeyValue.rikshallplatsNummer

end

The stop and time for the end of the the trip.

In the Samtrafiken ACCESS API, the codelist for stops will contain all Samtrafiken’s sellable national stop IDs (known as “rikshållplatser”). The stop IDs contain 9 digits and they will be used according to the codelist urn:x_swe:stn:nnnnnnnnn, where nnnnnnnnn is the stop ID.

List of stops used in Samtrafiken ACCESS:

Codelist: Stops

The timeTabledtime should be in local time

mode

The transport mode for the The stops to use in Samtrafiken ACCESS can be found in stops.xml in the daily NeTEx export from Samtrafiken.

See Codelist: Stops for more info and examples.

NeTEx - File: _stops.xml StopPlace.KeyValue.rikshallplatsNummer

mode

The transport mode for the leg. Use the OSDM ptMode enum. The list of transport modes used in Samtrafiken ACCESS with the corresponding NeTEx value:

...

Codelist: Product Category

NeTEx - ServiceJourney.KeyValue.productCode

vehicleNumbers

The vehicleNumber should be the published train number when possible. For buses and commuter trains without unique id:s use the line number.

Trains: NeTEx - TrainNumber.ForAdvertisment

Buses/trains without unique id:s: NeTEx - Line.PublicCode

carriers

In the Samtrafiken ACCESS API, the carrier IDs are used according to the codelist urn:x_swe:carrier:nnn, where nnn is the carrier ID.

Codelist: Carriers

publishedServiceName

Bör vi kräva att även det här fältet fylls i? Är väl oftast samma som vehicleNumbers

lineNumbers

Sammas om ovan. Men bör kanske anges vid RKM-trafik mm där linjebegreppet är centralt.

attributes

When the tickets are created by NDS attributes needed for creating the tickets may be needed in the request.This must be specified further.

Example SJ X2000 train Stockholm - Göteborg

...

languagenone

...

If the bus needs a unique published id, then use that value. In Samtrafiken’s NeTEx dataset, the value is (almost) always found in the ServiceJourney.PublicCode element.

Trains: NeTEx - TrainNumber.ForAdvertisment

Buses and other traffic: NeTEx - ServiceJourney.PublicCode

Info

There is an exception for this, and that is for trains that change their train numbers during their journey. In those cases it must be taken into consideration that the train number will be different depending on the departure stop of the TripSpecification.
For these trains the vehicleNumber should be the train number that is advertised at the stop of the departure.
In Samtrafiken’s NeTEx dataset, trains that change their train numbers during their journey is expressed as a single ServiceJourney with multiple JourneyParts that refer to TrainNumber-elements with different ForAdvertisment values. The corresponding ForAdvertisment value from these JourneyParts should be used as the vehicleNumber, in this exceptional case.

carriers

In the Samtrafiken ACCESS API, the carrier IDs are used according to the codelist urn:x_swe:carrier:nnn, where nnn is the carrier ID.

Codelist: Carriers

NeTEx - Line.KeyValue.salesAuthorityNumber

publishedServiceName

Optional and not used today to identify trips. If the field is filled in, it must contain the same value as vehicleNumbers.

lineNumbers

Optional and not used today to identify trips. If the field is filled in, it must contain the same value as vehicleNumbers.

attributes

When the tickets are created by NDS attributes must be sent in the request to be shown on the tickets.

Codelist: Attributes (service properties)

Example SJ X2000 train Stockholm - Göteborg

Code Block
languagenone
{
    "objectType": "OfferCollectionRequest",
    "tripSpecifications": [
        {
            "externalRef": "05ba799b-2f92-4c23-9336-a625795006ad|0|48ee70c7-99db-4c12-bfe6-422a30afc069",
            "legs": [
                {
                    "externalRef": "leg1",
                    "timedLeg": {
                        "start": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740000001",
                                "objectType": "stopPlaceRef"                            },
                            "serviceDeparture": {
                                "timetabledTime": "2023-09-15T06:27:00+02:00"                       }
                        },
                        "end": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740000002",
                                "objectType": "stopPlaceRef"                            },
                            "serviceArrival": {
                                "timetabledTime": "2023-09-15T09:35:00+02:00"                           }
                        },
                        "service": {
                           
                            "vehicleNumbers": [
                                "421"  ],
                                "mode": {
                                    "ptMode": "HIGH_SPEED_TRAIN"

                                },
                               "productCategory": {
                                    "name": "Snabbtåg",
                                    "shortName": "Snabbtåg",
                                    "productCategoryRef": "urn:x_swe:sbc:ST"

                                },
                            "carriers": [
                                {
                                    "ref": "urn:x_swe:carrier:74",
                                    "name": "SJ"                                }
                            ]
                        }
                    }
                }
            ],
            "isPartOfInternationalTrip": false
        }
    ],
    "offerSearchCriteria": {
        "offerMode": "INDIVIDUAL",
        "currency": "SEK"    },
    "anonymousPassengerSpecifications": [
        {
            "externalRef": "Adult",
            "type": "PERSON"
            
        }
    ],
    "corporateCodes": [],
    "promotionCodes": []
}

Example SL subway

Code Block
{

    "tripSpecifications": [
        {
            "externalRef": "05ba799b-2f92-4c23-9336-a625795006ad|0|48ee70c7-99db-4c12-bfe6-422a30afc069",
            "legs": [
                {
                    "externalRef": "leg18dff6e54-4444-4749-8a74-789281057f12|0|0",
                    "timedLeg": {
                        "start": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740000001740020757",
                                "objectType": "stopPlaceRef"                            },
                            "serviceDeparture": {
                                "timetabledTime": "2023-0910-15T0603T12:2738:00+02:00"
                                }
                        },
                        "end": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740000002740021650",
                                "objectType": "stopPlaceRef"                            },
                            "serviceArrival": {
                                "timetabledTime": "2023-0910-15T0903T13:35:00+02:00"
                                }
                        },
                         "service": {
                         "vehicleNumbers": [
                                "vehicleNumbers13":  [],
                                "421mode": {
],                                    "modeptMode": {"UNDERGROUND",
                                    "ptModename": "HIGH_SPEED_TRAINUnderground"

                                },
                               "productCategory": {
                                    "name": "SnabbtågCounty traffic",
                                    "shortName": "SnabbtågLT",
                                    "productCategoryRef": "urn:x_swe:sbc:STLT"

                                },
                            "carriers": [
                                {
                                    "ref": "urn:x_swe:carrier:74275",
                                    "name": "SJSL"                                }
                            ]
                        }
                    }
                }
            ],
            "isPartOfInternationalTrip": false
        }
    ],
    "offerSearchCriteria": {
        "offerMode": "INDIVIDUAL",
        "currency": "SEK"    },
    "anonymousPassengerSpecifications": [
        {
            "externalRef": "Adult""443a49be-3ff3-47a3-8efb-1def96c2be29",
            "type": "PERSON"
  
         
        }
    ],
    "corporateCodes": [],
    "promotionCodes": []
}

Example SL

...

bus line 212

Code Block
{
  
    "tripSpecifications": [
        {
            "externalRef": "05ba799b-2f92-4c23-9336-a625795006ad|0|48ee70c7-99db-4c12-bfe6-422a30afc069",
            "legs": [
                {
                    "externalRef": "8dff6e54-4444-4749-8a74-789281057f12|0|0leg1",
                    "timedLeg": {
                        "start": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740020757740024784",
                                "objectType": "stopPlaceRef"                            },
                            "serviceDeparture": {
                                "timetabledTime": "2023-1011-03T1210T14:3821:00+0201:00"
                                }
                        },
                        "end": {
                            "stopPlaceRef": {
                                "stopPlaceRef": "urn:x_swe:stn:740021650740020757",
                                "objectType": "stopPlaceRef"                            },
                            "serviceArrival": {
                                "timetabledTime": "2023-1011-03T1310T14:3538:00+0201:00"
                                }
                        },

                        "service": {
                            "vehicleNumbers": [
                                "13212"  ],
                                "mode": {
                                    "ptMode": "UNDERGROUNDBUS",
                                    "name": "UndergroundBus"
                                 },
                               "productCategory": {
                                    "name": "County traffic",
                                    "shortName": "LT",
                                    "productCategoryRef": "urn:x_swe:sbc:LT"
                                 },
                            "carriers": [
                                {
                                    "ref": "urn:x_swe:carrier:275",
                                    "name": "SL"                                }
                            ]
                        }
                    }
                }                 
                 
              
            ],
            "isPartOfInternationalTrip": false
        }
    ],
    "offerSearchCriteria": {
        "offerMode": "INDIVIDUAL",
        "currency": "SEK"    },
    "anonymousPassengerSpecifications": [
        {
            "externalRef": "443a49be-3ff3-47a3-8efb-1def96c2be29Adult",
            "type": "PERSON"
        }
    ],
    "corporateCodes": [],
    "promotionCodes": []
}