Internet Cloud Library Blocks

The Stackbuilder Library Tab (in the right rail), in the “Network & Communication” collection, has a number of software blocks that facilitate sending data to IoT cloud platforms. What follows is information on some of them. New ones are being added on a regular basis. A separate downloadable document on this support web site covers using Interstacks with PTC’s Thingworx IoT cloud platform.

Exosite Cloud HTTP API Interface
(~01dbd2dfd2468a11e59a6bcd55860b4b3e)
This block pre configures relevant properties of the base HTTP API block interstacks.com/support/internet-http with default values pertaining to Exosite's One Platform docs.exosite.com/portals/http such that the Block can work with minimal configuration by the user.

The only parameter required to be set by the user is their Exosite's Authentication Token called Client Identification Key (CIK) which can be set by the user for the exposed property named 'cik'

The default properties, which can be overridden, for this block are as follows:
'requesttype': 'POST' --> Preconfigure to allow sending device data to Exosite
'authtokenheader': 'X-Exosite-CIK' --> Specifies to use Exosite's CIK as the authentication header
'content-type': 'application/x-www-form-urlencoded' --> Format of the content type, may be changed to json for ease of use
'url': 'http://m2.exosite.com/api:v1/stack/alias'}) --> Default URL for device data to Exosite using version 1

icloudlib1

IBM Watson (Bluemix) IoT HTTP API
(~01adedbe025a8311e79d79f63ed4d343a0)

This block configures the HTTP API block with IBM specific parameters obtained from the user's account with IBM Watson to post data as a device. The parameters exposed by this block (in addition to those of the HTTP API block) are:

baseurl - string - Base URL to build the specific device URL. Defaults to "messaging.internetofthings.ibmcloud.com:1883/api/v0002/device/types"
orgid - string - Organization ID as specified in your IBM Watson IoT account settings
devicetype - string - Device Type as specified in your IBM Watson IoT account settings
deviceid - string - Device ID as specified in your IBM Watson IoT account settings
eventid - string - Event ID describing the event type. Typical event id may be "status" to indicate the status or value of a device's sensor data.
authtoken - string - Authentication Token password/token associated with the device for authentication with IBM IoT

The first five properties will build the specific URL for the event associated with the device and the authtoken property is the token associated with the device.

icloudlib2

The "init" input terminal will accept Python dictionaries/E-forms with all the keys specified above and their values along with all the keys associated with the HTTP API block.
The "http request" input terminal and the two output terminals are the same as that of the HTTP API Block.

Azure IoT Hub Device API
(~01fdc8daae569611e7a984ecc6e2eb86b7)

This block provides an interface to the Device API of Micrsoft Azure's IoT Hub. The connection parameters of the IoT Hub are specified via the following properties:

connection_string - string - Connection string of a device obtained from the IoT Hub for a specific device
device_id - string - Device ID of this device
token_validity - integer - Validity of an obtained token in seconds. Default is 86400 which equals 24 hours. The tokens get auto-renewed automatically without requiring user action
api_version - string - API version string of Azure IoT Hub to be used with the request. Default is "2016-02-03"

Input Terminals:

"1:init" - This terminal will accept dictionaries/E-forms with keys and values corresponding to the properties specified above.

"3:data" - Once connection to IoT Hub is established, any message received by this terminal will be sent to the Azure IoT Hub as JSON.

"5:current_time" - Since Azure connections rely upon computing Unix Time, this terminal accepts unix time to aid in making the connection. Typically this terminal is connected with the output terminal of the "sync time and date from server" block found in the "Network & Communication" section of the Library in Stackbuilder.

Output Terminals:

"2:status" and "4:http_response" are the same as that of the HTTP API Block

"6:sastoken_info" - Provides token information at the time of establishing a connection with Azure. May be used for verification by the end user.

icloudlib3

Refer to documentation on many other topics at interstacks.com/support.
Please email info@interstacks.com with any questions.