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: "973fc50d-eb01-475b-b048-1714a8068dbb") {
    ... on Booking {
      id
      selections {
        ... on JourneyOfferSelection {
          fares {
            id
            name
            price {
              amount
              currency
            }
          }
        }
      }
    }
  }
}
query GetBooking {
  node(id: "04ddc0a9-4d6a-42eb-825d-2e83add23b5b") {
    ... on Booking {
      id
      selections {
        ... on JourneyOfferSelection {
          fares {
            id
            name
            price {
              amount
              currency
            }
          }
        }
      }
    }
  }
}
Example: Get fare by id
graphql
query GetFare {
  node(id: "07fe9a6c-8766-4c96-b445-8a0c669efa69") {
    ... on SelectedFare {
      id
      name
      price {
        amount
        currency
      }
    }
  }
}
query GetFare {
  node(id: "6795c2cc-6162-4c72-baed-67d73b7359a6") {
    ... on SelectedFare {
      id
      name
      price {
        amount
        currency
      }
    }
  }
}

Types of Node

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