REST API Developer's Guide

Get Dashboards

You can use LogicMonitor's REST API to programmatically get information about the dashboards in your account.

Note: 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

sortsort={+ or -}propertySorts the response by the property specified in either increasing (+) or decreasing (-) order/dashboard/dashboards?sort=-id
filterfilter=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:

  • Greater than or equals: >:
  • Less than or equals: <:
  • Greater than: >
  • Less than: <
  • Does not equal: !:
  • Equals: :
  • Includes: ~
  • Does not include: !~
/dashboard/dashboards?filter=description~QA*
fieldsfields={list of properties separated by commas} Filters the response to only include the following fields for each object/dashboard/dashboards?fields=id,description
sizesize=integerThe number of results to display. Max is 1000/dashboard/dashboards?size=5
offsetoffset=integerThe 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)
		 }
	 });