description | layout | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn how you can add variables to an Airstack GraphQL query to provide dynamic inputs into the API. |
|
You can add variables to an Airstack GraphQL query to provide dynamic inputs.
To do so, simply define the variable with $
prefix and specify the correct typing.
As an example, below is shown on how a query looks like after and before adding variable to an Airstack query:
{% tabs %} {% tab title="After" %}
query MyQuery($fid: String) { # Define the variable with its typing
Socials(
input: {
filter: {
userId: {_eq: $fid} # replace the value with the variable
},
blockchain: ethereum
}
) {
Social {
profileName
}
}
}
{% endtab %}
{% tab title="Before" %}
query MyQuery {
Socials(
input: {
filter: {
userId: {_eq: "3"}
},
blockchain: ethereum
}
) {
Social {
profileName
}
}
}
{% endtab %} {% endtabs %}
If you have any questions or need help regarding adding variables into your Airstack query, please join our Airstack's Telegram group.