...
- It lets the client specify exactly what data it needs.
- It makes it easier to aggregate data from multiple sources.
- It uses a type system to describe data.
...
Example ) Simple query
Code Block |
---|
{
|
...
allMembers { |
...
members { |
...
name } } } |
Query Result
Code Block |
---|
{
"data": {
" |
...
allMembers": { " |
...
members": [ { " |
...
name": " |
...
Chun" }, { " |
...
name": |
...
"John" }, { "name": "Fred" }, ... |
Example 2) Query with condition
Code Block |
---|
members(id: "s20181031xyz") { name title |
...
} |
Result
Code Block |
---|
{ "data": |
...
{ "member": { "name": "Kenny", "title": "Senior Software |
...
Engineer", } |
...
}
} |
GraphQL supports various programming languages
...
You can see the same code at https://graphql.org/code/ in various programming languages, and reference query example at https://alligator.io/graphql/introduction-graphql-queries/