Query Anything

Many object types in the API implement the Node interface. This means that they have a unique id field. All objects that implement the Node interface can be queried by their id with the node query.

Using inline fragments

Since the node query can return any type of object that implements the Node interface you need to use inline fragments to access the fields of the returned object. See the GraphQL documentation for more information.

Example: Get Booking by id
graphql
query GetBooking {
  node(id: "3b7495e0-7b74-43b1-90cc-f68b08ccfc07") {
    ... on Booking {
      id
      selections {
        ... on JourneyOfferSelection {
          offers {
            id
            price {
              amount
              currency
            }
            parts {
              ... on AdmissionPart {
                conditions {
                  description
                  type
                }
                flexibility
                serviceClass
                comfortClass
              }
              ... on ReservationPart {
                conditions {
                  description
                  type
                }
                flexibility
                comfortClass
                accommodation {
                  type
                }
              }
            }
          }
        }
      }
    }
  }
}
query GetBooking {
  node(id: "c80cf576-428a-4366-912a-26c8ca574117") {
    ... on Booking {
      id
      selections {
        ... on JourneyOfferSelection {
          offers {
            id
            price {
              amount
              currency
            }
            parts {
              ... on AdmissionPart {
                conditions {
                  description
                  type
                }
                flexibility
                serviceClass
                comfortClass
              }
              ... on ReservationPart {
                conditions {
                  description
                  type
                }
                flexibility
                comfortClass
                accommodation {
                  type
                }
              }
            }
          }
        }
      }
    }
  }
}
Example: Get offer by id
graphql
query GetOffer {
  node(id: "8293d5d1-ee47-44e0-93af-25008178c9e4") {
    ... on Offer {
      id
      price {
        amount
        currency
      }
      parts {
        ... on AdmissionPart {
          flexibility
          serviceClass
          comfortClass
        }
        ... on ReservationPart {
          flexibility
          comfortClass
          accommodation {
            type
          }
        }
      }
    }
  }
}
query GetOffer {
  node(id: "1b8da837-b0d0-46ab-9ab7-a7deb35980b3") {
    ... on Offer {
      id
      price {
        amount
        currency
      }
      parts {
        ... on AdmissionPart {
          flexibility
          serviceClass
          comfortClass
        }
        ... on ReservationPart {
          flexibility
          comfortClass
          accommodation {
            type
          }
        }
      }
    }
  }
}

Types of Node

The following types implement the Node interface and can be fetched using the node query.