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: "5dba5299-91c2-4999-abba-374fdebd7e4d") {
... 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: "055e831f-cbc4-4b2e-9953-6f0838bcbd54") {
... 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: "6a98c03d-3c06-4bc8-9e21-1f0df2b7ed93") {
... on Offer {
id
price {
amount
currency
}
parts {
... on AdmissionPart {
flexibility
serviceClass
comfortClass
}
... on ReservationPart {
flexibility
comfortClass
accommodation {
type
}
}
}
}
}
}query GetOffer {
node(id: "db32c6ed-f447-47ef-9fbb-a914ff06f122") {
... 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.