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: "bf2ad058-13ec-4601-96c5-6e14b10250fa") {
... on Booking {
id
selections {
... on JourneyOfferSelection {
fares {
id
name
price {
amount
currency
}
}
}
}
}
}
}
query GetBooking {
node(id: "ac9e0e15-1271-4e59-ab54-8dd2d0f74587") {
... on Booking {
id
selections {
... on JourneyOfferSelection {
fares {
id
name
price {
amount
currency
}
}
}
}
}
}
}
Example: Get fare by id
graphql
query GetFare {
node(id: "9750dc36-675f-472d-8917-db72c69c95cf") {
... on SelectedFare {
id
name
price {
amount
currency
}
}
}
}
query GetFare {
node(id: "a052dc71-f7d5-4524-b233-857b95e77376") {
... 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.