Get Dashboards
Last updated on 28 January, 2021Overview
You can use LogicMonitor’s REST API to programmatically get information about the dashboards in your account. Specifically, you can get a list of dashboards or information on a specific dashboard.
As with all of our API calls, authentication is required.
Get a List of Dashboards
HTTP Method: GET
Resource URI: /dashboard/dashboards
Request Parameters: By default, a list of 50 dashboards will be returned. You can include sort, filter, fields, size and offset parameters in your request to control what data is included in the response and how it is formatted.
Property | Syntax | Description | Example URI |
sort | sort={+ or -}property | Sorts the response by the property specified in either increasing (+) or decreasing (-) order | /dashboard/dashboards?sort=-id |
filter | filter=property{operator}value | Filters the response according to the operator and value specified. Note that you can use * to match on more than one character.You can use the ‘.’ character to filter values within an object (e.g. custom properties), and multiple filters can be separated by a comma. Operators include:
|
/dashboard/dashboards?filter=description~QA* |
fields | fields={list of properties separated by commas} | Filters the response to only include the following fields for each object | /dashboard/dashboards?fields=id,description |
size | size=integer | The number of results to display. Max is 1000 | /dashboard/dashboards?size=5 |
offset | offset=integer | The number of results to offset the displayed results by | /dashboard/dashboards?offset=2 |
Example
The following Node.js script requests all dashboards in the account api.logicmonitor.com.
// Account Info
var accessId = '48v2wRzfK94y53sq5EuF';
var accessKey = 'H_D9i(f5~B^U36^K6i42=^nS~e75gy382ki8{)P+';
var company = 'api'
// Request Details
var httpVerb = "GET";
var epoch = (new Date).getTime();
var resourcePath = "/dashboard/dashboards";
// Construct signature
var requestVars = httpVerb + epoch + resourcePath;
var crypto = require("crypto");
var hex = crypto.createHmac("sha256", accessKey).update(requestVars).digest("hex");
var signature = new Buffer(hex).toString('base64');
// Construct auth header
var auth = "LMv1 " + accessId + ":" + signature + ":" + epoch;
// Configure request options
var request = require('request');
var options =
{
"method" : httpVerb,
"uri" : "https://" + company + ".logicmonitor.com/santaba/rest" + resourcePath,
"headers": {
'ContentType' : 'application/json',
'Authorization': auth
},
"qs": {
'fields': 'id,name',
'filter': 'name~ip'
}
};
// Make request
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(body)
}
});
Get Information About a Specific Dashboard
HTTP Method: GET
Resource URI: /dashboard/dashboards/{id}
Example
The following Node.js script requests dashboard 34 for account api.logicmonitor.com.
// Account Info
var accessId = '48v2wRzfK94y53sq5EuF';
var accessKey = 'H_D9i(f5~B^U36^K6i42=^nS~e75gy382ki8{)P+';
var company = 'api'
// Request Details
var httpVerb = "GET";
var epoch = (new Date).getTime();
var resourcePath = "/dashboard/dashboards/34";
// Construct signature
var requestVars = httpVerb + epoch + resourcePath;
var crypto = require("crypto");
var hex = crypto.createHmac("sha256", accessKey).update(requestVars).digest("hex");
var signature = new Buffer(hex).toString('base64');
// Construct auth header
var auth = "LMv1 " + accessId + ":" + signature + ":" + epoch;
// Configure request options
var request = require('request');
var options =
{
"method" : httpVerb,
"uri" : "https://" + company + ".logicmonitor.com/santaba/rest" + resourcePath,
"headers": {
'ContentType' : 'application/json',
'Authorization': auth
},
"qs": {
'fields': 'id,name',
'filter': 'name~ip'
}
};
// Make request
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Print out the response body
console.log(body)
}
});