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
  • Query language
  • Core concepts

Was this helpful?

  1. GraphQL at Eduflow

Introduction to GraphQL

PreviousUsageNextVariables

Last updated 4 years ago

Was this helpful?

Query language

is a query language for API's. It's query language can pull multiple objects of different types, with less queries that would be needed using REST.

Where else is GraphQL used? Facebook, GitHub

What does GraphQL do?

REST API's follow a concept of . The classic API is multiple endpoints for various resources alongside GET, POST, PUT and DELETE.

GraphQL on the other hand usually has one endpoint, always GET or POST. The magic is in the query passed in the post data.

Assume the following:

{
    institution {
        name
    }
}

Response:

{
  "data": {
    "institution": {
      "name": "Happy University"
    }
  }
}

A couple things:

  • The query to a single endpoint, via GET (?query=...) or POST (via POST data)

  • The response is JSON

  • The response structure matches the query

What's more is, GraphQL schemas enforce a structured, typed API, and provides instrumentation. This can best be put into example by seeing GraphiQL - a client for graphql - with the query above:

Core concepts

Queries and Mutations:

  • Query: Usually reading

  • Mutation: Usually create, updating or deleting

Basics

Advanced

:

: Optional parametrization

: Repeatable pieces of query

: Traverse through lists of data

GraphQL
architectural constraints
Fields
Type system
Object types
Enums
Lists
Interfaces
Variables
Fragments
Pagination