Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

About ThingSpace

ThingSpace is your gateway to a simplified IoT workspace for prototype through production. You have 24x7 access through a single, consolidated portal to everything you need to bring your IoT solutions to life, and to market.

Purpose of the scriptr.io connector for ThingSpace

The purpose of this connector is to simplify and streamline the way you access ThingSpace' APIs from scriptr.io, by providing you with a few native objects that you can directly integrate into your own scripts. This will hopefully allow you to create sophisticated connected devices.

Components

  • ThingSpace/Device : this is the main object to interact with. It provides access to the data that is generated by the devices of a given user (the one for who you are passing an access token).

  • ThingSpace/httpclient : generic http client that handles the communication between scriptr.io and ThingSpace' APIs.

  • authentication:

    • ThingSpace/authorization/getRequestTokenUrl: This script implements steps 1 of the ThingSpace OAuth authorization process.
    • ThingSpace/authorization/getAccessToken: This script implements step2 of the ThingSpace OAuth authorization process.
    • ThingSpace/authorization/login: This script starts a session and returns an session token.
    • ThingSpace/authorization/logout: This script ends a session and returns the session token.
  • ThingSpace/test/tests.js: a list of examples on how to use the connectors' objects and corresponding methods.

How to use

  • Use the Import Modules feature to deploy the aforementioned scripts in your scriptr account, in a folder named "modules/ThingSpace".
  • Create a developer account and an application at ThingSpace.
  • Once done, make sure to specify the ThingSpace username in "config" file ("username") and if you do not want to use full authentication with ThingSpace then make sure to specify the access token provided by ThingSpace in the config file("accessToken").
  • Create a test script in scriptr, or use the script provided in modules/ThingSpace/test/.

Step 1

Obtain session tokens from ThingSpace

First you need to specify your ThingSpace username, then you have to choose one of the two ways to login with ThingSpace: either to get the access token from your ThingSpace account and provide it in the config file, or to go through the authentication process.

  • Authentication process:

    • Run ThingSpace/authorization/getRequestTokenUrl API That require your ThingSpace password and returns authentication code.(Note: we do not save your password in scriptr, but we require it to authenticate since it is the only provided way to return an authentication code to request the access token.)
    • Run ThingSpace/authorization/getAccessToken that will return the access token and save it in storage.global.
  • after going through the authentication process or specifying the access token in the config file.

    • ThingSpace/authorization/login: This script starts a session and returns an session token.
    • ThingSpace/authorization/logout: This script ends a session and returns the session token.
  • ThingSpace/test/tests.js: a list of examples on how to use the connectors' objects and corresponding methods.

Step 2

Use the connector

In order to use the connector, you need to import the main module: modules/ThingSpace/device, as described below:

var deviceModule = require("/modules/ThingSpace/device");

Then create a new instance of the device class, defined in this module (we assume that we already otbained an access token):

var myDevice = new deviceModule.Device();

The Device class provides many methods to obtain data , such as:

myDevice.addDevices();
myDevice.activateDevices();
myDevice.suspendDevices();
myDevice.restoreDevices();
myDevice.RetreiveDeviceInfo();
myDevice.postDweet();
myDevice.getDweet();
myDevice.getLatestDweet();
myDevice.getCachedDweets();
myDevice.RetrieveListOfServicePlans();
myDevice.changeDeviceIdentifier();
myDevice.changeDeviceServicePlans();
myDevice.changeDeviceCostCenter();
myDevice.changeDeviceCustomFields();
myDevice.retrieveDeviceUsageHistory();
myDevice.retrieveDeviceConnectionHistory();
myDevice.retrieveDeviceProvisioningHistory);
myDevice.retrievePRLVersionFromDevices();
myDevice.retrieveAggregatedDeviceUsageData();
myDevice.createDeviceGroup();
myDevice.retrieveListOfDeviceGroups();
myDevice.getInformationaboutDeviceGroup();
myDevice.updateDeviceGroup();
myDevice.deleteDeviceGroup();

About

No description, website, or topics provided.

Resources

Releases

No releases published

Packages

No packages published

Languages