REST API Developer's Guide

API Troubleshooting

If you're running into issues with LogicMonitor's REST API, this document should help you identify the issue and quickly find a resolution.  We'll make sure this page stays up to date and continue to add possible issues as we come across them.  Consider the following:

  1. If you're using cURL, try using the -v flag for more detail, like the HTTP status code.
  2. Are you getting an HTTP 200?  If so, the issue likely pertains to incorrect syntax or use of a particular REST resource.  Reference our detailed documentation on the specific resource for more information.
  3. If you're getting an HTTP 401 - check your credentials.  If you're sure they are correct - are you using API Tokens?  See the section below.
  4. Are you using Windows command prompt to make cURL requests? See the section below.

 

LMv1 Authentication Issues

If you're attempting and failing to authenticate REST API requests with API Tokens:

  1. Make sure you've consulted our example scripts.  Typically, issues with API Token authentication can be traced back to an incorrect construction of the signature.  Specifically, you need to make sure to use a Hex digest for the HMAC SHA-256 algorithm.  These examples illustrate how to construct the signature in various different languages.
  2. Use the following request parameters in your script and confirm that you get the correct Authentication Header below:

Request Parameters:


Access Id:84GKZTJ7UNB43U84w8qC
Access Key:(8f~NrDi$5mr{6+S82W4XkB~%Ih8)6SItNX3XfKH
HTTP Verb: GET
Resource Path: /dashboard/widgets
data: ''
epoch:1502813538347

Auth Header:


LMv1 84GKZTJ7UNB43U84w8qC:MzFmZWJlZmJlMTMxNmI3NjFmYTE5OTgyZWFlODU3ZDhiOTdmYWNiYzc2NGViOTFlNWYwNjJhZjQxNWNiZDMzYQ==:1502813538347

 

If you aren't getting the correct Authentication Header, here are a couple of intermediate values that may help you troubleshoot (for the same request parameters listed above):


Concatenated Request Variables (HTTP Verb + epoch + data + resource path) : GET1502813538347/dashboard/widgets
HMAC-SHA256 of Request Variables (using Access Key & a Hex digest) : 31febefbe1316b761fa19982eae857d8b97facbc764eb91e5f062af415cbd33a
Base 64 encoded HMAC value: MzFmZWJlZmJlMTMxNmI3NjFmYTE5OTgyZWFlODU3ZDhiOTdmYWNiYzc2NGViOTFlNWYwNjJhZjQxNWNiZDMzYQ==

 

 

Making cURL requests with Windows

If you're using the Windows command prompt to run cURL commands, note that the Windows command prompt doesn't support single quotes.  This can be an issue because JSON data payloads are typically specified with single quotes.  As an alternative, you can save the JSON data in a .txt file and use the @filename syntax in your curl command, like so:


curl -u user:password -d @payload.txt -H "Content-Type: application/json" -X POST "https://account.logicmonitor.com/santaba/rest/service/services"