httpCall (url, verb, content, tagManagerName)

Call a URL from a tag manager under the current user's account.

Arguments

url: An URL that begins with "http://" The tag manager only supports HTTP.

verb: The HTTP verb to use, must be either "GET", "PUT", "POST" or "DELETE".

content: Optional content to upload for PUT or POST verb. If the content starts with "{" or "[", i.e. it looks like a JSON format, the content type will be automatically set to "application/json", otherwise, to "application/x-www-form-urlencoded".

tagManagerName: Optional. If the current user account has more than 1 tag manager, specify the name of the tag manager here to use for the HTTP call. If omitted, the current selected tag manager will be used.

Returns

Nothing.

Remarks

The tag manager calls the URL asynchronously so it is not possible to get return value from the HTTP server currently. KumoApp.httpCallExternal calls the HTTP server synchronously and returns the HTTP status code.

Below is an example "Turn on Phillips Hue Lamp when door is open and off when closed" using Hue API :
var hue_bridge=<%Hue bridge IP address%>;
var hue_user = <%Hue username%>;
var hue_lampids = <%Hue lamp IDs (separate by ,)%>;
[<#door sensors_[12|52|53]_N#>].forEach(
function (sensor) {
    sensor.opened = function () {
        hue_lampids.split(",").forEach(function(id){
            KumoApp.httpCall("http://"+hue_bridge+"/api/" + hue_user+"/lights/"+id+"/state", "PUT", 
            '{"hue": 50000,"on": true,"bri": 200}');
        });
    };
    sensor.closed = function () {
        hue_lampids.split(",").forEach(function(id){
            KumoApp.httpCall("http://"+hue_bridge+"/api/" + hue_user+"/lights/"+id+"/state", "PUT", 
            '{"on": false}');
        });
    }
});