Skip to main content

Features Overview

GraphQL API Features

Introduction

EasyManage GraphQL APIs make your data instantly accessible via GraphQL API. Build and ship modern apps and APIs faster. Deploy a real-time, secured GraphQL API against any supported database.

The EasyManage Builder Studio generates your GraphQL schema and resolvers based on your tables/views selected in build. You don't need to code / write a GraphQL schema or resolver. Also generated are a range of possible queries, subscriptions, mutations and operators.

Databases

Please refer to APIs Reference Databases for details.

GraphQL Schema

GraphQL Schema is generated for your data, and we provide an instant GraphQL API based on schema. EasyManage provides extended scalars to handle Date and Time types. Schema includes types, queries, mutations and input types.

info

Naming Conventions for GraphQL schema: Update, We have implemented graphql-default. In this naming convention:

  • PascalCase is used for Type names, Query, Mutation, Subscription names
  • camelCase is used for field names and arguments

But this documentation may not have been updated to reflect above, and might show examples in previous naming convention.

The schema are generated and provisioned for each table. Please refer to respective *Schema.graphqls file for details, e.g. dbgraphql\src\main\resources\graphql\Customer\CustomerSchema.graphqls

# Defined in Root schema: scalar EmDateTime | EmDate | EmTime 

type Customer {
customerId: String
name: String
phone: String
...
}

input CustomerInput {
customerId: String
name: String
...
}

GraphQL APIs Made Available Are

Please refer to Feature Support Matrix Table for backend.

Queries

GraphQL Queries help to fetch data from server and databases. The queries describe the shape of the data we want to receive from the GraphQL server.

query { 
ProductQuery
(productId: 10) {
productId
productType
productDesc
}
}

Mutations

GraphQL mutations serve purpose of modifying data on the server (i.e. write, update or delete data).

mutation { 
ProductUpdate
(productId: 10 ,
productTbl1 : {
productId : 10 ,
productType : "Medicine" ,
productDesc : "Ampicillin" ,
}) {
productId
productType
productDesc
}
}

Subscriptions

A GraphQL subscription provides clients continous updated data, with interval, or whenever the value of any field changes upstream.

subscription { 
NotifyProductQuery
(productId: 10) {
productId
productType
productDesc
}
}

Example client calls for GraphQL

These are generated and provisioned for each table. Please refer to respective *ClientInfo.txt file for details, e.g. Customer_GraphqlClientInfo.txt in location dir: dbgraphql\src\main\java\com\example\emapi\app

They will save you lot of typing to test graphql apis. example call for Create (insert):

mutation { 
CustomerCreate(CustomerTblRec1 : {
customerId : "StringVal" ,
name : "StringVal" ,
...
requestedqty : 10 ,
reqquoteamt : 10.0 ,
}) {
customerId
name
}
}

Authentication & Authorization

Authorization is performed with Basic Auth User/Password, and can be extended to JWT token based or OAuth 2.0. Access control is based on roles USER , ADMIN. e.g. Allow delete mutation only for ADMIN roles via @PreAuthorize.

Please refer to Readme for Security at: dbgraphql\security\Readme_Security_Gql.txt

@MutationMapping  
@PreAuthorize("hasRole('ADMIN')")
@Transactional
public Long ProductDelete(@Argument("productId") long productId)

Serverless