diff --git a/lib/api/host.js b/lib/api/host.js index e2e2bb2..2acb138 100644 --- a/lib/api/host.js +++ b/lib/api/host.js @@ -1,4 +1,5 @@ var client = require("../client"); +var util = require("util"); /*section: host *comment: mute the given host, if it is not already muted @@ -27,22 +28,22 @@ function mute(hostname, options, callback){ callback = options; options = {}; } - var params = { - body: { - hostname: hostname - } - }; + var params = {}; if(typeof options === "object"){ + params.body = {}; // create body property if(options.end){ params.body.end = parseInt(options.end); } if(options.override){ params.body.override = options.override; } + } else { + params.body = ""; // create empty body } - client.request("POST", "/host", params, callback); + client.request("POST", util.format("/host/%s/mute", hostname), params, callback); } + /*section: host *comment: unmute the given host, if it is not already unmuted *params: @@ -62,12 +63,8 @@ function mute(hostname, options, callback){ * ``` */ function unmute(hostname, callback){ - var params = { - body: { - hostname: hostname - } - }; - client.request("POST", "/host", params, callback); + var params = {body: ""}; // create empty body + client.request("POST", util.format("/host/%s/unmute", hostname), params, callback); } module.exports = {