TH | EN

GraphQL

GraphQL is a query language for accessing data through an API and operates with a server-side runtime. Developed by Facebook, it enables front-end developers to request exactly the data they need in a flexible and efficient way. Users can define both the structure and the content of the data they want, without requiring back-end developers to create new APIs—as long as the existing data structure remains unchanged. This helps address common issues with RESTful APIs, where predefined requests and responses often lead to over-fetching, under-fetching, or the need to make multiple API calls to gather complete data.

The GraphQL implementation of the NEXIIOT Platform serves as a Management API, utilizing Graphcool Playground as a Backend-as-a-Service (BaaS) to create and manage a GraphQL backend. It allows users to manage the database schema and data directly through a web-based UI, which looks as follows:

_images/gql_UI.png

The interface shown above is divided into four sections:

  1. Section 1 is used to define the function (query or mutation) to be executed.

  2. Section 2 is for specifying variables to be sent via HTTP headers—for example, the Authorization token.

  3. Section 3 displays the response returned from the server.

  4. Section 4 is the Play icon, which is used to execute the function.

To use the tool, start by filling out Sections 1 and 2 (if the function requires authentication), then click the Play icon (Section 4) to execute the function. The result will be displayed in Section 3.

The current version of GraphQL is V.2, which includes several enhancements for improved functionality and completeness. You can access it via https://gqlv2.nexiiot.io.

The available functions are categorized into three main types as follows: