Getting Started
The Zoomdata Client is a JavaScript library that exposes an API to embed Zoomdata charts into a web application. For developers interested in extracting data from existing Zoomdata sources, the Zoomdata Client offers an API to create and update queries that push data to a web or NodeJS application via WebSockets.
To get started, you need to include the zoomdata-client.js
library in your application.
Installing the Zoomdata Client Library
npm install zoomdata-client@_your_zoomdata_server_version_
In the above command, replace the "_your_zoomdata_server_version_" with the desired version string, e.g.3.0.0
. The zoomdata-client
is built using the UMD (Universal Module Definition) pattern to offer compatibility with the most popular script loaders.
You can use the zoomdata-client
in a browser with a script tag that addsZoomdataSDK
to the globalwindow
object:
<script src="node_modules/zoomdata-client/distribute/zoomdata-client.js"type="text/javascript"></script>
or as a commonJS module:
var ZoomdataSDK = require("zoomdata-client")
Alternative to NPM Installation
If you wish to use the version of the library bundled in your Zoomdata server installation, use the following script tag:
<script src="_your-zoomdata-server-url_/zoomdata/sdk/zoomdata-client.js"type="text/javascript"></script>
Credentials Configuration
The zoomdata-client
requires an API key to communicate with the Zoomdata server. For a detailed guide on generating an API key, visit Zoomdata's main documentation portal and search for: Generating a Security Key
.
With a security key in hand, you can create a credentials
object to use when creating an instance of the Zoomdata client:
const credentials = { key: 'your-security-key' }
Application Configuration
In addition to the credentials configuration, you need to configure the zoomdata-client to point to an existing Zoomdata server. You can create anapplication
object like:
const application = { secure: true, host: 'zd-server.com', port: 8443, path: '/zoomdata' }
where the properties are defined as:
- secure:
true
to use HTTPS (secure) protocol, otherwisefalse
- host: the base URL where your Zoomdata server is hosted
- port: The port used by your Zoomdata server for communication
- path: The path used for your Zoomdata server. The default is
'/zoomdata'
Creating a Client Instance
With the Zoomdata Client library loaded in your application, create an instance of a client by calling the createClient
method:
ZoomdataSDK.createClient({credentials, application})
The createClient
method returns a Promise
that resolves with an instance of client. Click here to learn more about the client instance or head over to the individual guides to learn about the most common use cases.