Get started
Data Graphs Javascript SDK is a simple client library that provides comprehensive interaction with the Data Graphs API.
Pre-requisites
To use the SDK you will need an apiKey
, clientId
and clientSecrect
for the Data Graphs project you are working with. If you have not generated these already, you can do so in Data Graphs’ Applications settings. For more information see Authentication.
Installation
1npm install --save @datalanguage/datagraphs-client
Configuration
You can configure your Data Graphs client using either environment variables or the Data Graphs client constructor.
Using environment variables
Set the following variables in your application script:
DATAGRAPHS_PROJECT_ID
DATAGRAPHS_API_KEY
DATAGRAPHS_CLIENT_ID
DATAGRAPHS_CLIENT_SECRET
Then create the client as follows:
1// Require the library
2const Datagraphs = require("@datalanguage/datagraphs-client");
3
4// Create the Data Graphs client
5const datagraphs = new Datagraphs();
Using constructors
If you are configuring the client using a constructor, set it up as below:
1// Require the library
2const Datagraphs = require("@datalanguage/datagraphs-client");
3
4// Create the Data Graphs client with config
5const datagraphs = new DataGraphs({
6 projectId: "my-test-project",
7 apiKey: "bZiDs4.....",
8 clientId: "sR5dfR.....",
9 clientSecret: "pRM6kR.....",
10});
All of the constructors can be set up in this way, eg:
Learn more about the Data Graphs API in the Knowledge Base and the API Reference. The Client SDK repo is available on GitHub.