Querying including real-time and static data API connections, etc.
The uSmart Resource Query Language (URQL) enables you to query the data stored in uSmart in order to perform actions including downloading data, creating visualisations and aggregating data. The manual is available here and it can be used in the following ways:
Within a dataset using the query builder
Here you can use the filter and sort options and this actually creates a URQL for you!
Within a dataset using the latest urql
Here is where you can take a single view of the data with a query - this particular query is against a static point in time for the data. For querying the latest version use the uSmart client SDK connection (see below).
Within a dataset when creating a visualisation using viz wiz
To create a visualisation within the Visualisation Wizard you need to have some knowledge of URQL. Visualisations are added by selecting the Visualisation Tab when signed into a dataset and clicking to add, copy or edit a visualisation.
Add in Cameron’s latest visualisations.
By connecting to a dataset via the USMART client SDK
Connection is done via the SDK and guidance can be found on the Discovery view of the dataset
It's easy to subscribe to a data stream with USMART. You just need a USMART client SDK and the information included on this page: organisation GUID and dataset GUID.
Use the organisation and dataset GUIDs to connect to the USMART real-time service. After that, it's all up to you. The code samples on this page show the subscription code for each supported client SDK. If you have not already done so, set up one of our client SDKs and get started.
Access GUIDs
The organisation publishing the dataset.
Organisation GUID Example: 9261083136-6c2b-4a26-a0a0-b903bde0dc46
The dataset you would like to subscribe to.
Dataset GUID Example: 2e887717-3c33-4d46-779167-95be307289a2
You may also need to include your user account and an API key to connect. An example code is shown as follows:
Code
var usmartSDK = require('usmart-sdk');
var usmart = new usmartSDK.USMART({keyId: "<>", keySecret: "<>"});
var organisation = '28ccd497-7cad-4470-bd17-721d5cbbd6ef';
var dataset = 'da6c9979-4b41-4338-8cfe-012ea16d4bda';
usmart.subscribe(organisation, dataset).progress(function(data){
console.log(data.value);
})
Cacheing
Cacheing can be used to help improve query return reliability and speed up the return of data from a dataset. This is done by adding the term cache=true
cache=true
. An example of that being used is shown below:
https://api.usmart.io/org/92610836-6c2b-4a26-a0a0-b903bde0dc46/4dd7a850-858c-4e65-a456-772f76e93ec1/latest/urql?limit(-1)>(Timestamp,Date1)&cache=true