Skip to content

Latest commit

 

History

History
74 lines (64 loc) · 1.7 KB

variables.md

File metadata and controls

74 lines (64 loc) · 1.7 KB
description layout
Learn how you can add variables to an Airstack GraphQL query to provide dynamic inputs into the API.
title description tableOfContents outline pagination
visible
true
visible
true
visible
true
visible
visible
true

🌪️ Variables

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 %}

Developer Support

If you have any questions or need help regarding adding variables into your Airstack query, please join our Airstack's Telegram group.

More Resources