diff --git a/lib/api/screenboard.js b/lib/api/screenboard.js index aeac641..6096a66 100644 --- a/lib/api/screenboard.js +++ b/lib/api/screenboard.js @@ -6,14 +6,11 @@ var util = require("util"); /*section: screenboard *comment: create a new screenboard *params: - * title: the name of the screenboard - * description: description of the screenboard - * graphs: | - * an array of objects which required the following keys - * * title: the name of the graph - * * widgets: an array of widgets, see http://docs.datadoghq.com/api/screenboards/ for more info + * boardTitle: the name of the screenboard + * widgets: an array of widgets, see http://docs.datadoghq.com/api/screenboards/ for more info * options: | * optional, a object which can contain any of the following keys + * * description: description of the screenboard * * templateVariables: | * an array of objects with the following keys * * name: the name of the variable @@ -21,6 +18,7 @@ var util = require("util"); * * default: optional, the default value for this tag * * width: the width of the screenboard in pixels * * height: the height of the screenboard in pixels + * * readOnly: the read-only status of the screenboard * callback: function(err, res) *example: | * ```javascript @@ -30,9 +28,8 @@ var util = require("util"); * app_key: "app_key" * }; * dogapi.initialize(options); - * var title = "my screenboard"; - * var description = "it is super awesome"; - * var graphs = [ + * var boardTitle = "my screenboard"; + * var widgets = [ * { * type: "image", * height: 20, @@ -49,17 +46,18 @@ var util = require("util"); * prefix: "host", * "default": "host:my-host" * } - * ] + * ], + * description: "it is super awesome" * }; * dogapi.screenboard.create( - * title, description, graphs, options, + * boardTitle, widgets, options, * function(err, res){ * console.dir(res); * } * ); * ``` */ -function create(title, description, graphs, options, callback){ +function create(boardTitle, widgets, options, callback){ if(arguments.length < 5 && typeof arguments[3] === "function"){ callback = options; options = {}; @@ -70,12 +68,14 @@ function create(title, description, graphs, options, callback){ var params = { body: { - title: title, - description: description, - graphs: graphs + board_title: boardTitle, + widgets: widgets } }; + if(options.description){ + params.body.description = options.description; + } if(options.templateVariables){ params.body.template_variables = options.templateVariables; } @@ -85,6 +85,9 @@ function create(title, description, graphs, options, callback){ if(options.height){ params.body.height = options.height; } + if(options.readOnly){ + params.body.read_only = options.readOnly; + } client.request("POST", "/screen", params, callback); } @@ -185,7 +188,7 @@ module.exports = { share: share, getUsage: function(){ return [ - " dogapi screenboard create