Table of Contents

HTTP Requests

Overview

Some devices only have a HTTP control protocol. These devices can be controlled from a web browser by entering specific URLs into the browser.

To control these devices via iViewer, the communications can be defined in a variety of ways, depending on your requirements:

    1. Easiest method.
    2. GET requests only.
    1. Most powerful, but complicated method.
    1. Moderate complexity and flexibility.
    2. Not commonly used method.

HTTP/HTTPS Systems

When you create a system in the guiDesigner System Manager, amongst the available protocol options are HTTP and HTTPS. These two options allow you to easily create HTTP GET Requests, either unsecured (HTTP), or secured (HTTPS).

To use HTTP or HTTPS systems, you enter the root hostname or IP Address of the HTTP end point as the system hostname property. Then define the port to use, most commonly port 80 for HTTP or port 443 for HTTPS.

Then for the command values, all you have to enter is the request suffix. This should be the URL content after the hostname.

So for example, if you control a device via a web browser with a URL such as:
http://myhouse.dyndns.org:8080/transport?action=playpause

Then the System Hostname would be myhouse.dyndns.org and port number 8080.
The command value would be /transport?action=playpause.

Manually Crafted Commands

Alternatively, a raw TCP system can be used. In this case, the command value to send needs to be crafted to follow the HTTP Request standard formatting.

Basic Format

Below is an example of a basic HTTP Request in the format you would need when creating a command within guiDesigner:

GET /sample.html?power=0 HTTP/1.1\x0D\x0AHOST: 192.168.0.179\x0D\x0A\x0D\x0A

Lets break that down:

  1. GET defines a HTTP GET request. Another options would be POST (although we wont cover HTTP POST requests here).
  2. The next part is the URL to access, prefixed with a forward slash.
  3. HTTP/1.1 defines the HTTP protocol version. Another option would be 1.0 (although 1.1 should work fine in most cases).
  4. Then a newline (a carriage return is also required by some systems - as shown in the above example).
  5. HOST defines the IP address or hostname where the request is being sent. You could enter the static IP address of the device, or a web address such as www.commandfusion.com (if the device is accessible in this manner)
  6. Finally end the request with two new lines (with carriage return if your system requires it).

The command value is simply entered into the Command Properties when creating (or editing) a command in guiDesigner.

The system the command belongs to needs to be defined to use port values of 80 (or whichever port the device listens on for HTTP requests, if unsure, try port 80) and set to TCP mode.
You should leave all other options empty. Checking 'maintain constant connection' might work with your device, so give it a try with or without this option checked. It will make a difference (good or bad) to the speed at which commands are received by the system.

More Details

There a many resources for HTTP Request formatting, here are a couple of good ones:

The Requestb.in website is great for debugging HTTP requests, more info on their website:
http://requestb.in