Static Widget API

This API allows you to interact with your widgets via static HTTP POST/GET calls vs. dynamic scripting. This enables direct and open access to your widgets to support third-party desktop and mobile applications.

The API is simple enough for mobile phones to control and monitor widgets and robust enough to support LabVIEW applications.

Get the “widgetID”

A widget created on the ioBridge.com Interface created an embed tag for use on websites. To connect the API calls to the widget you will need the the “widgetID”.

API Access

To access the API, you can use GET or POST calls. You can also use “http” or “https” to send API calls.

HTTP GET

http://www.iobridge.com/widgets/static/id=[widgetID]

HTTP POST

http://www.iobridge.com/widgets/static id=[widgetID]

Parameters

To send additional parameters to the API, use an ”&” as a delimiter for each parameter passed.

Here is an example:

http://www.iobridge.com/widgets/static/id=[widgetID]&value=1&format=xml

Here are the parameters that you can send to the API:

id

Required – widgetID of widget created on the ioBridge.com Interface

value

Optional – Value to be passed to the widget (URL encoded)

  • Logic High/On/1 – value=1
  • Logic Low/Off/0 – value=0

format

Optional – Type of format for the API response (Default is Text)

  • Plain Text – format=text
  • HTML – format=html
  • WAP/WML – format=wml
  • XML – format=xml
  • JSON – format=json
  • VoiceXML – format=vxml
  • TwiML – format=twiml
  • TwiML SMS – format=twimlsms

callback

Optional – Callback parameter for JSONP objects and cross-domain scripting

API Responses

A call to the API returns a response depending on the success and type of request. The response will be wrapped in the appropriate headers if the format parameter is passed.

Here are the following possible responses:

Sent

If you send a command to a control widget and the command was issued successfully, you will get the word “Sent” returned back to you

Error

If you send a command to a control or monitor widget and the command was issued unsuccessfully, you will get the word “Error” returned back to you

Offline

If the web gateway is offline, the response will be “Offline”

Values

If you send a call to a monitor widget, you will receive a scaled or labeled value depending on the widget settings

Example Applications

Secure HTML Form

This is an HTML form that uses HTTP POST to send a value to a control widget.

<html>
  <head>
    <title>Static Widget API with HTML Form</title>
  </head>
  <body>
        <form action="https://www.iobridge.com/widgets/static" method="post">
          <textarea row="2" cols="16" id="value" name="value"></textarea><br />
          <input type="hidden" name="id" value="ah0MtPBUZN5c" />
          <input type="submit" value="Submit" />
        </form>
  </body>
</html>

WAP/WML Page

This example is a WML formatted page to control a digital output using HTTP GET calls.

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD WML 2.0//EN"
    "http://www.wapforum.org/dtd/wml20.dtd">

<wml>
  <card title="Room Lights">
    <p><a href="http://www.iobridge.com/widgets/static/id=s3T4SXSOjH4X&value=1&format=wml">On</a></p>
    <p><a href="http://www.iobridge.com/widgets/static/id=s3T4SXSOjH4X&value=0&format=wml">Off</a></p>
  </card>
</wml>