Skip to content
Developerhome

Use of GraphQL for queries and mutations

  Less than to read

GraphQL is the only way to access the relational database used by Sage Distribution and Manufacturing Operations (SDMO).

For a user and developer dealing with APIs, there is no direct SQL access to the database. This ensures security, applied to nodes and operations, and tenant isolation. A GraphQL operation can only access the tenant to which the user is connected.

There is no limit to the data accessible for published nodes.

The purpose of this section is not to provide extensive GraphQL training but to give you some insights and examples about how it is implemented for Sage Distribution and Manufacturing Operations.

The GraphiQL editor allows you to navigate through nodes. GraphiQL is accessible from the main URL of the tenant with the /explorer subdomain.

GraphiQL is the easiest way, in conjunction with documentation, to navigate across the schema and look at all the available nodes. The main page of the GraphiQL tool is divided into three columns:

  • On the left column, queries and mutations are entered using the GraphQL syntax. A query returns data, and a mutation performs updates.
  • The middle column displays the results.
  • On the right column, you can access the schema directly.

If you want to access customer data, and its nodes are associated with a package, the autocompletion features propose the package list. When you select a package, you can obtain the nodes list.

Once you select a node, you can select the properties you want. When a property is a reference, you can pick the properties you need.

A nested query, edge, or node structure is used to list all the records.

If a property is a collection of references, you can embed a query with an array of records by adding a query, edge, or node with a nested structure. You can do this whether the collection is vital or not.