Eduflow
  • Welcome
  • API Reference
  • API Explorer
  • Getting started
    • API Overview
    • Authentication
    • Usage
  • GraphQL at Eduflow
    • Introduction to GraphQL
    • Variables
    • Fragments
    • Paginating queries
    • Inline fragments
  • Guides
    • Institutions
    • Courses
    • Flows and Activities
    • Reviews and Reflections
    • Discussions
    • Quizzes
    • Users & Participants
    • Tags
    • Course summary (outputs)
    • vs Peergrade
  • API Changelog
Powered by GitBook
On this page
  • Variables

Was this helpful?

  1. GraphQL at Eduflow

Variables

PreviousIntroduction to GraphQLNextFragments

Last updated 4 years ago

Was this helpful?

Variables

GraphQL offers a way to reuse your queries dynamically through . These will come into play especially if you're accessing the API programmatically (such as our ).

Before:

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

With variables:

query($courseId: UUID!) {
  course(id: $courseId) {
    id
    title
    flows {
      title
    }
  }
}
{
  "data": {
    "course": {
      "id": "00000000-5945-95c7-65fd-a9747b200317",
      "title": "History of Dunder-Mifflin",
      "flows": [
        {
          "title": "Founding A Company"
        },
        {
          "title": "Corporate Citizenship"
        }
      ]
    }
  }
}

See also

Here's an example of what this would look like :

from GitHub's GraphQL API docs ()

from Shopify's API docs ()

Working with variables
archive.org
GraphQL Variables
archive.org
variables
Node or Python examples
in the API Explorer
GraphiQL allows variables to be passed on the bottom-left pane.