I tried the sample in the book Learning GraphQL, 1st Ed, by O’Reilly:
query {
person(personID: 5) {
name
birthYear
}
}
on https://graphql.org/swapi-graphql
and was able to get back:
{
"data": {
"person": {
"name": "Leia Organa",
"birthYear": "19BBY"
}
}
}
However, I tried to look for how to omit the personID and get all people, but can’t:
query {
person {
name
birthYear
}
}
or
query {
allPeople {
name
birthYear
}
}
They both gave errors and I can’t find the answer in many parts of the book.
I did see an example like this:
query {
allLifts {
name
status
}
}
which is for all ski lifts in a "fake ski resort". So my Star War query is very similar to it but it doesn’t work.
How can it be done?