Skip to end of metadata
Go to start of metadata

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.

GraphQL is a syntax that describes how to ask for data, and is generally used to load data from a server to a client. GraphQL has three main characteristics:

  • It lets the client specify exactly what data it needs. - It helps you to reduce/optimize API instead of creating all methods by all the use cases.
  • It makes it easier to aggregate data from multiple sources.
  • It uses a type system to describe data.

Example ) Simple query 

{
  allMembers {
    members {
      name
    }
  }
}

Query Result

{
  "data": {
    "allMembers": {
      "members": [
        {
          "name": "Chun"
        },
        {
          "name": "John"
        },
        {
          "name": "Fred"
        },
        ...



Example 2) Query with condition

  members(id: "s20181031xyz") {
    name
    title
  }

Result

{
  "data": {
    "member": {
      "name": "Kenny",
      "title": "Senior Software Engineer"
    }
  }
}


GraphQL supports various programming languages 

  • C# / .NET

  • Clojure

  • Elixir

  • Erlang

  • Go

  • Groovy

  • Java

  • JavaScript

  • PHP

  • Python

  • Scala

  • Ruby

You can see some same codes at https://graphql.org/code/ in various programming languages, and reference query example at https://alligator.io/graphql/introduction-graphql-queries/