About GraphQL
Getting start with Query language



Query language for API
Facebook Inc.
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools

Why ClassApp use GraphQL?

ClassApp has chosen GraphQL because it offers more flexibility for developers. GraphQL gives possibility to send and request only useful data from our database with few endpoints.

Query (GET)
Its responsible to FETCH data. Return fields are explicitly declared


REQUEST
{
  organizations{
    nodes{
      fullname
      dbId
    }
  }
}
RESPONSE
{
  "data": {
    "organizations": {
      "nodes": [
        {
          "fullname": "Hogwarts School",
          "dbId": 42
        },
        {
          "fullname": "Art School",
          "dbId": 43
        },
      ]
    }
  }
}

  

Mutation (POST)
Its responsible to SEND data. Return fields are explicitly declared


REQUEST
{
  createEntity(
    input:{
      organizationId: 1,
      type: "STUDENT",
      fullname: "ANAKIN SKYWALKER"
    }
  )
  {
    entity {
      id
      fullname
    }
  }
}
RESPONSE
{
"data": {
  "entity": {
    {
      "id": 1443,
      "fullname": "ANAKIN SKYWALKER",
    }
  }
}