Last edited 6 months ago
by Serena Cericola

GraphQL API

Revision as of 20:00, 22 December 2023 by Andrea Gazzarini (talk | contribs) (Created page with "==Introduction== The Share-VDE Domain Model can be queried using GraphQL. This page describes the interface in terms of entities, operations, parameters and information rel...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

The Share-VDE Domain Model can be queried using GraphQL.

This page describes the interface in terms of entities, operations, parameters and information related with this interaction mode.

Schema

GraphQL is a schema-based contract interface. That means a domain using GraphQL as interaction protocol must declare a schema where the following things need to be defined:

  • entities
  • attributes
  • operations
  • parameters

A special set of constructs within the protocol/language allow clients to query and introspect the defined schema. Here's an example

{
  __schema {
    types {
      name
    }
  }
}

which produces the following response (partial):

  "data": {
    "__schema": {
      "types": [
        {
          "name": "Agent"
        },
        {
          "name": "AgentClause"
        },
        {
          "name": "AgentCollection"
        },
        {
          "name": "AgentStructQL"
        },
        ...

More information about the GraphQL introspection capability can be found here; also please keep note the Share-VDE GraphiQL UI provides a navigable section which queries the schema and provides the introspection data in a human-readable way (see the Docs link on the right side of the UI).

Directives

At time of writing there's only one directive in the Share-VDE GraphQL Schema: it is called "availableOnlyFor" and it is used to mark protected resources that require a privileged role for their access.

See the following schema extract:

{
 type Provenance {
    uri: ID!

    code: String

    description: String

    status: [RuntimeClusterStatus] @availableOnlyFor(role: "svde-editor-base")
}

In the example, the status field is accessible only if the requestor has a svde-editor-base (or higher) role associated. Otherwise it will return null.

Provenances

Being a cross-cutting concept, the Provenance API and their behaviour are detailed in this top-level section, beside the other available API.

Search API

This category includes all endpoints that are part of the Share-VDE Search API: they require a caller having a minimal role level (svde-reader).

The available endpoints are detailed in this page.

Curation API

This category includes the access to those resources that are part of Share-VDE Curation API. Due to the level of information exposed, the access to these resources require at least a basic editing role capabilities (i.e. svde-editor-base or higher)

The available endpoints are detailed in this page.