Accessing the LogicMonitor REST API with Postman and Bearer Token Authentication
This is a follow-up to the classic Kurt_Huffman post: Accessing the LogicMonitor REST API with Postman and LMv1 API Token Authentication | LogicMonitor - 5143 That post is still a treasure trove of good discussion. Definitely check it out if you haven't already! While there is passing mention that you can use bearer token auth in Postman, I figured I'd write up a dedicated post. Creating a bearer token With the addition of bearer tokens, we eliminate the need for a Base64 encoded HMAC signature – so we get rid of several steps for auth. No need for any pre-request script, yay! See this page for generating and using bearer tokens in LogicMonitor:https://www.logicmonitor.com/support/bearer-token We do have a section in the above page on using the bearer token with Postman, but I like setting up with environment variables for better reusability. Postman setup with bearer tokens Download and installPostman, or usehttp://postman.com Launch Postman andcreate a new collectionthat will be used for all LogicMonitor API requests. Create anew environmentwith the following variable. You just need one for the bearer token. You should set the type to 'secret' for sensitive credentials. url – https://<portalname>.logicmonitor.com/santaba/rest If you want to work with theLM Ingestion API, duplicate this environment and change the url to 'https://<portalname>.logicmonitor.com/rest' (without "santaba") bearer – secret – For the current value, be sure to prepend the token with "bearer " (with space) Should look like this:bearer lmb_xxx Create arequest within the collection. A sample request is shown below with the necessary parameters configured. Set the environment for the request (from step 3) Set the HTTP method for the request Use{{url}}to pull the base URL from the environment variable. Add the resource path and any request parameters your API request may require. Add the following headers: Authorization:{{bearer}} X-version: 3 (for latest LM API version) POST, PUT, and PATCH requests only: if your request includes JSON data, be sure to select the Body tab and select raw JSON301Views18likes6CommentsUsing Postman to create multiple Websites via API & CSV?
Hi, I’m testing out creating websites (or resources) via the API. I have a standard Post working in Postman just fine. However, when I then try to do the same thing via a CSV file in the Runner section, I’m getting 401 Authorization errors. When I look at the data that’s being sent, it looks the same as what’s sent when I run it manually. Is there something special I need to do when running a Post command via the Runner vs the manual Send command? Thanks.Solved535Views12likes40CommentsCan I pull a specific system property in an API call?
Hi, I’m writing an API call that pulls only specific fields. I can get all the normal fields, but I want to get system.groups. System.groups is inside the systemProperties array of variables and I haven’t been able to figure out if I can pull it. I’m using: &fields=name,displayName,collectorDescription,hostStatus and want to add systemProperties[system.groups] but can’t find any syntax that will work. I’ve found examples on how to Filter on a property, but not how to just display it. Anyone know how I can do this? Thanks.340Views3likes10CommentsHow do I configure Postman AUthentication for API
HI, I’m relatively new to Postman and API calls but have a decent grasp on how they work. However, I can’t figure out how to handle the Authentication part within LM. I read through the various KB articles but didn’t find a step-by-step which is what I need for this one. I was able to grab my ID and Key from our portal, but I’m not sure where I put them in Postman. Do I create them as variables and then add them as parameters somehow? I made a Collection for LM, but when I edit it and go to the Authentication area, I’m not sure which item to choose as none seem to let me put in an ID and a Key. Can anyone help me with how I get this setup? Thanks.646Views3likes11Comments