LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.

Learn More

Getting Dashboard Details

Last updated on 07 October, 2024

You can use LogicMonitor REST API v3 to get dashboard details. You must authenticate yourself before making the API request.

Getting List of Dashboards

URI: GET /dashboard/dashboards

ParameterTypeDescription
fieldsStringThe response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma.
Example – /dashboard/dashboards?fields=id,description
sizeIntegerIndicates the number of result to display. A maximum of 1000 results can be requested in a GET request. By default, a list of 50 dashboards is returned if a value is not provided for this parameter.
Example – /dashboard/dashboards?size=10
offsetIntegerIndicates the number of results to offset the displayed results.
Example – /dashboard/dashboards?offset=5
filterStringThe response is filtered according to the operator and specified value that is, filter=property:value
  • Use an asterisk (*) to match more than one character
  • Use a dot (.) character to filter values within an object (example – custom properties)
  • Use a comma (,) to separate multiple filters

Operators include:
  • Greater than or equals >:
  • Less than or equals <:
  • Greater than >
  • Less than <
  • Equals :
  • Does not equal !:
  • Includes ~
  • Does not include !~
Example – /dashboard/dashboards?filter=groupName~Server Dashboard*

The following Node.js script requests all dashboards in the account api.logicmonitor.com.

//Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
//Note: The below is provided for illustration purposes only.
var readlineSync = require('readline-sync');
var accessId = readlineSync.question('Enter your AccessId: ', { hideEchoBack: true });
var accessKey = readlineSync.question('Enter your AccessKey: ', { hideEchoBack: true });
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)
         }
     });
Node.js

Getting Details of Specific Dashboard

URI: GET /dashboard/dashboards/{id}

ParameterTypeDescription
idInteger(Mandatory) The ID of the dashboard whose details you want to get.
templateBooleanIf set as true, then return the dashboard template either in json format or return the file. By default, it is set as false.
formatStringThe format is used only if the template is set as true. Supported formats are json or file. The default format is json.
fieldsStringThe response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma.
Example – /dashboard/dashboards/id?fields=name,description

The following Node.js script requests dashboard 34 for account api.logicmonitor.com.

//Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
//Note: The below is provided for illustration purposes only.
var readlineSync = require('readline-sync');
var accessId = readlineSync.question('Enter your AccessId: ', { hideEchoBack: true });
var accessKey = readlineSync.question('Enter your AccessKey: ', { hideEchoBack: true });
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)
         }
     });
Node.js

Getting List of Widgets based on Dashboard ID

URI: GET /dashboard/dashboards/{id}/widgets

The query parameters fieldssizeoffset, and filter should also be included while making the GET call /dashboard/dashboards/{id}/widgets. Please refer the table in the section Getting list of Dashboards for details about the query parameters.

An additional parameter id which is specific to GET call /dashboard/dashboards/{id}/widgets has been described in the following table.

ParameterTypeDescription
idInteger(Mandatory) The ID of the dashboard to get the widget list specific to the dashboard.

In This Article