SevOne Data Insight GraphQL Guide
About
Data Insight uses GraphQL as the query language to access Data Insight and NMS data. This document outlines how to access GraphQL for testing and administration purposes.
Please refer to graphql.org for more information on this technology framework.
Access using GraphiQL
GraphiQL is a web-based GUI front-end that allows users to execute arbitrary GraphQL queries and browse the result. It also exposes the GraphQL schema documentation that explains all the possible queries, inputs, and outputs.
GraphiQL is bundled with Data Insight, but is disabled by default. To use it, configuration is necessary to enable it. Additionally, the user accessing GraphiQL must also have Internet access, as GraphiQL components are partially downloaded from the Internet when it starts.
Update /opt/SevOne/chartconfs/di_custom.yaml to add enableGraphiql: true to the graphql section. For example,
graphql:
enableGraphiql: true
Once the change is deployed, GraphiQL is accessible at the URI /retinaserver/playground.
Click the Docs button in the upper-right corner to explore GraphQL schemas.
Access using Postman
Postman (https://www.getpostman.com/) is a free third-party tool that is installed on Windows or Mac. It has support for querying GraphQL. No configuration is necessary to Data Insight to use this tool.
Once installed, you may construct a request by specifying HTTP method POST, address to your Data Insight server in form of https://<sdi_server>/retinaserver, and then set request type GraphQL under the Body tab.
GraphQL Authentication
Before running any queries for data via GraphQL, the user must be authenticated. This is done using the authenticate mutation.
The token returned indicates a successful authentication. This token must be passed in the request headers of all successive queries to GraphQL.
Set Authentication Header for GraphiQL using Chrome Browser
- Install a Chrome extension to manipulate request headers. For the purposes of this document, we will use ModHeader (https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj).
- Use this tool to set the request header X-Auth-Token to the token.
Other browsers may have the ability to install extensions or plugins that provide similar functionality.
Set Authentication Header for Postman
- Click the Authorization tab.
- Set TYPE to API Key.
- Set Key to X-Auth-Token.
- Set Value to the token returned in the prior step.