Errors and Problems

General HTTP error codes and generic situations

The following standard HTTP error codes are used in the specification:

Error Code Description
400 Bad request
401 Unauthorized
403 Forbidden
404 Not found
405 Method not allowed
409 Conflict
429 Too many requests
500 Internal server error
501 Not implemented
503 Service unavailable

Functional Errors

The OSDM API makes use of the JSON Problem structure to return information about functional errors in the handling of a request. The problem structure is defined in RfC-9457 which defines a way to carry machine-readable details of errors in a HTTP response to avoid the need to define new error response formats for HTTP APIs.

For OSDM, the following properties are supported:

Property Description Mandatory
code The code property should begin with the code of the error type yes
title Short, human-readable summary of the problem type which should not change from occurrence to occurrence of the problem. yes
type An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type (e.g., using HTML). yes
detail Human-readable explanation specific to this occurrence of the problem no
status The HTTP status code generated by the origin server for this occurrence of the problem. no
    no

A problem message is typically made of a code, title and a detail. The title and detail are not translated and the expected language there should be in English. It is up to the implementers to foresee a translation based on the code if relevant. Optionally, a problem message can contain reference to resources in the model.

The list of all error codes that can be returned by the API, needs to exposed on an URI:

https://<host>/errors/<error-code>

where host denotes the host of the API.

Examples

No result found for given request

"problem": {
  "code": "urn:uic:problem:NO_RESULTS",
  "type": "https://osdm.io/errors/no-results",
  "title": "The search did not return any result",
  "detail": "The place `Duckburg` could not be found",
  "status": 404,
}

Request not conform OpenAPI schema

"problem": {
  "code": "urn:uic:problem:MALFORMED_REQUEST",
  "type": "https://osdm.io/errors/malformed_request",
  "title": "Request failed schema validation",
  "detail": "The request does not validate the OSDM OpenAPI schema specification",
  "status": 400,
}

Request with invalid input

"problem": {
  "code": "urn:uic:problem:VALIDATION_ERROR",
  "type": "https://provider.domain/osdm/documentation/errors/validation_error",
  "title": "Passenger details missing",
  "detail": "The passenger does not contain all mandatory information to confirm the booking",
  "status": 400,
}

Standardized Technical Errors

In order that OSDM implementations behave consistently in error situations, the following error codes must be supported in case of technical errors by all implementations:

Problem code Description
RESOURCE_NOT_FOUND The requested (sub) resource could not be found. Could be deleted or expired
OPERATION_NOT_PERMITTED Trying to perform an operation that is not permitted.
NO_RESULTS The search did not return any result
VALIDATION_ERROR The request contains incorrect information
MALFORMED_REQUEST The request does not match the OSDM specification. Possible version mismatch
MISSING_INFORMATION Missing information. Provide the mandatory information and try again
PARAMETER_NOT_SUPPORTED A given request parameter is not supported and ignored while handling the request
INVALID_INPUT Provided input is invalid.
UNKNOWN_ERROR Unexpected or unspecified error occurred
PROPERTY_SUBSTITUTED Requested property is not available and is substituted. Check the response for the substitute
PARTIAL_SUCCESS The request could not be fully processed and is partially processed
SERVICE_UNAVAILABLE The service is currently not available
UNAUTHORIZED Client is no authorized

Standardized Functional Errors

In order that OSDM implementations behave consistently in error situations, the following error codes must be supported in case of functional errors by all implementations:

Functional area Error Code Title
Places PLACE_INVALID_CHARACTERS Invalid characters in the search string
Places PLACE_NO_RESULTS The search did not return any result
Trips TRIP_INVALID_CHARACTERS A search criteria value contains invalid value or invalid characters
Trips TRIP_SEARCH_CRITERIA_OUTSIDE_BOUNDARY A search criteria lies outside accepted boundaries
Trips TRIP_PLACE_UNKNOWN A provided place is not known 
Trips TRIP_NO_SEARCH_RESULT The search did not return any result
Offers OFFER_TRIP_NOT_FOUND The referenced trip cannot be found (expired ?)
Offers OFFER_INVALID_CHARACTERS A search criteria value contains invalid value or invalid characters
Offers OFFER_SEARCH_CRITERIA_OUT_OF_BOUNDS A search criteria lies outside accepted boundaries
Offers OFFER_PLACE_UNKNOWN A provided place is not known
Offers OFFER_SCHEDULE_MISMATCH Schedule mismatch between systems
Offers BOOKING_RESERVATION_OPTION_NOT_AVAILABLE The requested reservation option is not available on this vehicle
Offers BOOKING_PASSENGER_PROPERTY_NOT_MODIFIABLE Attempted to modify a read-only property (passenger)
Offers BOOKING_OFFERPART_PROPERTY_NOT_MODIFIABLE Attempted to modify a read-only property (reservation, ancillary or fare)
Booking BOOKING_OFFER_NOT_FOUND Referenced Offer or offer part not found (offer expired ?)
Booking BOOKING_INCOMPATIBLE_OFFER_PART Incompatible offer part with the offer
Booking BOOKING_INFORMATION_MISSING Missing information
Booking BOOKING_INSUFFICIENT_AVAILABILITY Insufficient availability for one of the requested products
Booking BOOKING_PLACE_NOT_AVAILABLE The requested place is not available
Booking BOOKING_MODIFY_READ_ONLY_PROPERTY Attempted to modify a read-only property
Booking BOOKING_BOOKING_ALREADY_CONFIRMED The booking is already confirmed
Booking BOOKING_BOOKING_ALREADY_CANCELLED The booking is already cancelled
Booking BOOKING_MODIFICATION_NOT_ALLOWED The booking and does not allow modifications
Booking BOOKING_VEHICLE_TOO_HEAVY A vehicle is too heavy to be transported by car carriage. This relates to the current load of the train or coach, so booking might be possible at another
Booking BOOKING_VEHICLE_WEIGHT_MISSING A vehicle is not possible without providing the weight of the vehicle
Confirm CONFIRMATION_PARTIAL_SUCCESS Partial success 
Confirm CONFIRMATION_OPERATION_NOT_SUPPORTED Operation not supported on one of the offer parts
Confirm CONFIRMATION_UNKNOWN_ERROR Unknown error on provider side
Confirm CONFIRMATION_INFORMATION_MISSING Missing information in the booking
Confirm CONFIRMATION_FULFILLMENT_TYPE_NOT_SELECTED Fulfillment type not selected
Confirm CONFIRMATION_BOOKING_ALREADY_CONFIRMED Booking already confirmed
Confirm CONFIRMATION_BOOKING_ALREADY_FULFILLED Booking already fulfilled
Confirm CONFIRMATION_BOOKING_ALREADY_CANCELLED Booking already cancelled

The lists can be extended by an implementor but at least these errors must be captured and they must be presented with the codes listed here above.

In case they wish to pass additional problems specific to their situation and not covered by any of the case below, they can do so by replacing the OSDM namespace with custom namespace starting with an X_ followed by an unique identifier for the provider (ex: X_NVS_NOMEAL).

Warnings

In addition to errors, a generic warnings mechanism is used to pass non-blocking information or events, such as a price difference with the initially offered price at booking time to the caller.

A warning message is typically made of a code and a detail. The details are not translated and the expected language there should be in English. It is up to the implementers to foresee a translation based on the code if relevant. Optionally, a warning message can contain reference to resources in the model.

"warning": {
  "code": "PLACE_PROPERTY_NOT_RESPECTED",
  "type": "https://osdm.io/warnings/place-property-not-respected",
  "title": "Place property not respected",
  "detail": "Place property `WINDOW` is not respected in offer with id `123456`",
}

Standardized Functional Warnings

In order that OSDM implementations behave consistently in warning situations, the following warning codes must be supported in case of functional warnings by all implementations:

Functional area Warning Code Title
Reservation PLACE_PROPERTY_NOT_RESPECTED Place property not respected
Offers OFFER_NO_RESULTS The trip search did not return any result
todo todo todo

As for the warnings, an implementor is required to use these warning codes and descriptions for the situations identified in order to be compliant.

In case they wish to pass additional warnings specific to their situation and not covered by any of the case below, they can do so by replacing the OSDM prefix with an X_ followed by an unique identifier for the provider (ex: X_NVS_NOMEAL).

Dealing with Unsupported Parameters in Requests

Some OSDM requests potentially support a large number of parameters (e.g. filters). Supporting all of them is not always possible, e.g. due restrictions of the underlying systems. Thus the following rule applies:

  • If the parameter is required, return an error “PARAMETER_NOT_SUPPORTED”.
  • If the parameter is optional, return a response including a warning indicating that the optional request parameter was ignored.