A Beginner's Guide to working with Dell OpenManage Enterprise API and Postman
Download PDFWed, 10 Jul 2024 21:48:14 -0000
|Read Time: 0 minutes
Introduction
OpenManage Enterprise, often shorted to OME, is Dell’s server lifecycle management and monitoring console solution. In addition to the GUI, OME supports RESTful API to enhance automation and integration capabilities. The OME API enable customers to leverage Dell’s integration packs with Ansible and Terraform, and to build scripts and code based on common programming or scripting languages such as Python and PowerShell. To help kickstart your journey into interfacing with the OpenManage Enterprise API, this document provides examples of using REST API calls to perform common server management tasks, and highlights a few useful resources.
What Is a RESTful API?
A RESTful API, in short, is a modern method to interrogate and update information stored by a program. OME and its family of plugins, iDRAC, and many other Dell Technologies products have addressable APIs. This RESTful API is far better than the legacy method of using CLI commands because it returns information in a standard machine-readable format, such as JSON or XLM. This makes the input and output data easier to process programmatically. There is an online portal for developers that includes interactive reference material and other resources, with details of API calls, variables, and data output with examples. This site covers many of Dell's APIs, including OME with plugin, iDRAC, PowerStore, and more. It also provides resources such as blogs and details about upcoming events. For example, see the AIOps blog APEX AIOps Infrastructure Observability (formerly CloudIQ) and Postman.
Figure 1. Dell's Developers portal, showing OME API details
Getting started with APIs
To check that APIs calls are working as expected, and to help speed up creating code, customers can use a 3rd party API tester, such as the popular test tool Postman. Using the Postman GUI, customers can execute API calls interactively and validate results to confirm how a particular API works. There are many REST actions: the most common are GET (used to retrieve information), POST (to create new information), and PUT (to update data information). Using Postman, we can simply send an API call to OME and review the output, as in the figure below.
Figure 2. Example Postman test of OME API with results
Working with Postman
Before we begin, here is a quick word about OME user authentication. To use the RESTful OME API, we need details of an OME user account and password with the correct OME rights level necessary to execute the command. (For details about user roles “RBAC”, privileges, and scope-based access, see the OME User's Guide.) Enter the required credentials into Postman at the authorization menu, using the “Basic Auth” type, as shown in Figure 3.
Figure 3. Entering OME credentials in Postman
When those basics steps are complete, we are ready to test some OME API calls. Here are some simple GET examples to show how the OME and the OME API works.
As each device is discovered it is given a unique individual device ID by the OME instance. This unique device ID is required in many OME API calls to target an individual server to report or update its attributes. In the following example we use the Dell tag number to determine the OME device ID. To check this, we can also refer to the device ID as it is displayed on the OME GUI on the device page.
Warning : The OME API is case sensitive, so calls must be used exactly as documented.
Example API call with parameters using a “GET”
https://<IP Address>/api/DeviceService/Devices?$filter=DeviceServiceTag eq '1234ABC'
https://<IP Address>/api/DeviceService/Devices?$filter=DeviceName eq 'device name’
hyperlink to OME RESTful API document showing all options DeviceService/Devices
Note : You must include single quotes (‘ ’) around the service tag number or device name. IP address is the OME Virtual appliance address. This IP address can be replaced by the OME appliance’s name.
Figure 4. OME API test with result – using the Dell server tag number to find the device ID
We can now use this device ID to interact with OME to find additional information, such as host name operating system.
Figure 5. OME API test with result – use the OME device ID to look up server operating system and host name
Using the OME device ID, it is easy to find useful information. For example, we can review the log of one server https://<IP Address>/api/DeviceService/Devices(nnnn)/HardwareLogs, where nnnn is the OME supplied device ID.
When using use a POST command, we may need to pass some parameters to OME. In Postman we do this by entering the data to be passed in the body area. Using Postman, we can enter the required code with parameters in the body area using the pretty format setting to help make the layout readable. Then, we use the JSON formatting setting to pass the call and data to the OME API.
In the following example, we are collecting server power data from the Power Manager plugin using MetricService/Metrics. We are passing a number of parameters, including the plugin ID, Device ID, power data, and the historical range
Example API call with parameters using a “POST”:
https://<IP Address>/api/MetricService/Metrics
Figure 6. Post command outputting server power data with attribute table on the right
Using the device ID number, OME (using the API) can also send commands and the required parameters to the target server, such as to blink an LED or to power a server off/on using “POST” JobService/Jobs (Figure 7).
Figure 7. Post command JobService/Jobs using DeviceAction Task and Device ID & OME GUI displaying job detail
Postman can also automatically generate code snippet suggestions from the tested API call. This code can be created in a number of scripting and programming languages. Just select the required language, such as PowerShell or Python, from the dropdown. This example code is a starting point for real scripts and programs.
Dell maintains a repository on GitHub of useful example code using API calls in PowerShell and Python for many Dell products, including OME, iDRAC, and APEX AIOps Infrastructure Observability (formally CloudIQ). You can also find downloadable OME integration packs for Ansible and Terraform there.
Conclusion
Let’s take a look back at what we have covered above. We have walked through the basic steps needed to set up and configure Postman to access the OME REST API, including using credentials with Postman for authentication. Then to help you get your feet wet, we reviewed the use of a collection of OME GET and POST API calls in Postman.
To learn more about OME REST API, you can visit the Dell Developer portal.
References
- Dell Technologies Developer Portal
- Dell's area GitHub with example code and integration packs
- Support page for Dell OpenManage Enterprise
- OpenManage Enterprise 3.10 RESTful API Guide (for OME 4.0 and higher: now migrated to the Dell Developer's Portal)
- OpenManage Enterprise 4.1.x User’s Guide
- OpenManage Enterprise Ansible automation: Inventory Management | Videos | Dell Technologies Info Hub