Skip to content

WebAPI - GraphQL

As of the release 2023.11 of Easit GO, the web API supports GraphQL giving you as a developer more control over the request / response flow.

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.

  • URL to endpoint: https://urltoEasitGO/graphql/
  • URL to schema: https://urltoEasitGO/graphql/schema/

Quick intro

The GraphQL web API for Easit GO have two root types, query and mutation, both sent as an HTTP/HTTPS request with the POST method. Each type has a set of operations, for example the query type has, alongside many others, operations to fetch available item types in the specified module, fetch a single item by id and fetch items in the specified module. The mutation type have, for example, operations for creating, updating and deleting items.

Read more about query operations here and mutation operations here. For more reading about GraphQL in general, please read more on graphql.org/learn.

Authorization

The GraphQL web API implements the Bearer authentication (also called token authentication) as its authentication scheme. This means that in order to access the GraphQL API, you must send your API key in the Authorization header when making a request:

1
    Authorization: Bearer <apikey>

API-key vs. User

Behind every API-key is a user connected to it. A user can have one or more API-keys. This user will be displayed as Created by and / or Update by on items when posting updated to items or creating new items in Easit GO. The users access determines what items can be updated and created in and retrieved from Easit GO.

So in short you create a user that can login with all methods or with username and password, give it the access it should have and generate an API-key for that user.

Syntax

Query

1
2
3
4
5
    {
        operation(argument){
            listOfReturnTypeFields
        }
    }
1
2
3
    {
        "query":"{ operation ( argument ) { listOfReturnTypeFields } }"
    }

Mutation

1
2
3
4
5
6
7
8
9
    {
        mutation {
            operation(mutationOperationArgument:[
                {
                    listOfMutationOperationArgumentInputTypeFields
                }
            ])
        }
    }
1
2
3
    {
        "query":"mutation { operation ( mutationOperationArgument : [ { listOfMutationOperationArgumentInputTypeFields } ] ) }"
    }

Let's go

To make it as easy as possible, we have gathered some basic examples to get you started. You can find them under Examples in the left navigation. If you want a more guided start, please go to the Exploring the GraphQL API page.