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.
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”.
To access the API, you can use GET or POST calls. You can also use “http” or “https” to send API calls.
http://www.iobridge.com/widgets/static/id=[widgetID]
http://www.iobridge.com/widgets/static id=[widgetID]
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:
Required - widgetID of widget created on the ioBridge.com Interface
Optional - Value to be passed to the widget (URL encoded)
Optional - Type of format for the API response (Default is Text)
Optional - Callback parameter for JSONP objects and cross-domain scripting
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:
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
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
If the module is offline, the response will be “Offline”
If you send a call to a monitor widget, you will receive a scaled or labeled value depending on the widget settings
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>
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>