Providing Variables Values
Providing variables values in crucial aspect of making queries and mutation dynamic and adaptable in GraphQL. We can pass the values in the graphql query using the Graphql Query Variable Field.
query GetPerson($id: ID!) {
person(id: $id) {
name
age
address
}
}
Values:
{
“id” :7
}
Output:
Variables in GraphQL
GraphQL is a query language for API (Application Programming Interface). It was developed by Facebook in 2012 after they released it publicly in 2015. Graphql Provides a more efficient, powerful, and flexible alternative to traditional REST APIs. In this article, we will learn about variables in GraphQL.