Altair SmartCore brings two ways to publish data: pushing it to an external system or pulling it with REST API.
Pulling data with Altair SmartCore REST API
Accessing Altair SmartCore REST API needs to have a valid Apikey to access requested data. Go to the control panel “My account” menu and check your Apikey. Its a big alphanumeric token like:
Then accessing your data is as simple as querying Altair SmartCore providing the Apikey header.
Here is an example using cURL. If you are not familiar with cURL you might want to check the official page: http://curl.haxx.se/ for installation instructions and documentation. We will assume you will have it installed and running. You can also try it with other REST clients such as hurl (http://www.hurl.it/) or Poster plugin (https://addons.mozilla.org/en-us/firefox/addon/poster/).
This will return the corresponding result to a query. In this example, Altair SmartCore will return streams (maximum 1000 streams) corresponding to defaultDevice@smartcore device.
Pushing data with a trigger
Triggers are the way Altair SmartCore automatically push the data received to external systems. A trigger must be associated to a service. Each data received by a device of that service will launch the trigger to push the data.
Triggers are managed in “Rules” → “Trigger (Push)” section in the control panel.
Create a trigger is basically define where you want to push your data in terms of HTTP parameters, we will only visit mandatory or important ones:
- Name: define a name for your trigger. It will be used to generate an id_developer so you will be able to work with it in the SDK and in REST API
- Max retries: when Altair SmartCore push data, it is possible that the counter part is unreachable. This field defines the maximum number of retries for pushing a single data
- Push frequency: define the number of minutes that Altair SmartCore will wait before pushing the data. 0 is for enqueuing the data immediately
- Id service is mandatory to associate devices below
External configuration is the main HTTP configuration:
- URL (mandatory), for example http://api.othersystem.com/listenservice
- Verb, for example GET
- Create a listener from device
To test your trigger you only need to send a data stream to a device of the associated service and you will receive it in the defined URL.