GraphQLGraphQL
Watch
0
Star
0
Category
Developer Environment
Works with
Tags
Version
1.0
Last updated
2018-07-17
Repository
Documentation
License
Download
Discuss
Details
Version history
Issues
Discuss

What's new in this version

2018.1

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.

GraphQL implementation for InterSystems Data Platforms

Gitter Gitter Gitter

Install GraphQL

  1. Download the last release.
  2. Import it to the target Caché namespace, f.e. to SAMPLES.
  3. Create new web aplication:
    • Name - /
    • Namespace - your target namespace, f.e. SAMPLES
    • Dispatch Class - GraphQL.REST.Main

Install GraphiQL

  1. Use an available release or build it on your own
  2. Create new web aplication:
    • Name - /graphiql
    • Namespace - your target namespace, f.e. SAMPLES
    • CSP Files Physical Path - f.e. C:\InterSystems\GraphiQL\

Example

Query and Result

sample sample

sample sample

Example queries for copy and past on demo server:

Queries can be simple and complex for several sets of data

{
  Sample_Person{
    Name
    DOB
    FavoriteColors
    Office {
      City
      State
      Street
      Zip
    }
  }
  Sample_Company{
    Mission
    Name
    Revenue
  }
}

Filtering

At the moment, only strict equality is supported:

{
  Sample_Person(id: 116){
    id
    Name
    DOB
    FavoriteColors
    Home {
      City
      State
      Street
      Zip
    }
    Office {
      City
      State
      Street
      Zip
    }
  }
}

Pagination

Pagination is supported through 4 functions that can be combined to achieve the necessary result:

  • after: n – all records with id greater than n
  • before: n – all records with id smaller than n
  • first: n – first n records
  • last: n – last n records
{
  Sample_Employee(after: 120, before: 123){
    id 
    Name
  }
  
  Sample_Person(first: 2){
    id
    Home {
      City
      State
      Street
      Zip
    }
  }
  Sample_Company(last: 3){
    id 
    Name
  }
}