# Variables

## Variables

GraphQL offers a way to reuse your queries dynamically through [variables](https://graphql.org/learn/queries/#variables). These will come into play especially if you're accessing the API programmatically (such as our [Node or Python examples](https://docs.eduflow.com/getting-started-1/usage#api-access)).

Before:

{% tabs %}
{% tab title="Query (no variables)" %}

```graphql
{
  course(id: "00000000-5945-95c7-65fd-a9747b200317") {
    id
    title
    flows {
      title
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "course": {
      "id": "00000000-5945-95c7-65fd-a9747b200317",
      "title": "History of Dunder-Mifflin",
      "flows": [
        {
          "title": "Founding a Company"
        },
        {
          "title": "Corporate Citizenship"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

With variables:

{% tabs %}
{% tab title="Query (with variables)" %}

```graphql
query($courseId: UUID!) {
  course(id: $courseId) {
    id
    title
    flows {
      title
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "course": {
      "id": "00000000-5945-95c7-65fd-a9747b200317",
      "title": "History of Dunder-Mifflin",
      "flows": [
        {
          "title": "Founding A Company"
        },
        {
          "title": "Corporate Citizenship"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

Here's an example of what this would look like [in the API Explorer](https://docs.eduflow.com/getting-started-1/usage#session-based-graphiql):

![GraphiQL allows variables to be passed on the bottom-left pane.](https://2518674650-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3GmK_EkZyQQJhTJyLh%2F-MScskjCNqzXIW35iIFf%2F-MSd2LcjhVG898I8xEgY%2Fimage.png?alt=media\&token=03811052-4c9c-4ddb-aa6b-b32b1e1ec7d7)

#### See also

* [Working with variables](https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#working-with-variables) from GitHub's GraphQL API docs ([archive.org](https://web.archive.org/web/20210203142000/https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#working-with-variables))
* [GraphQL Variables](https://shopify.dev/concepts/graphql/variables) from Shopify's API docs ([archive.org](https://web.archive.org/web/20200420144945/https://shopify.dev/concepts/graphql/variables))

##

##
