Dell Kace K1000 System Management Appliance 7.X, REST API, and Python
I am in the process of currently writing new Python code to query the Dell Kace K1000 System Manager to populate various reports and integration points. In my department, we currently use K1000 not only as a system management solution, but also as a system of record (SOR) for various unique pieces of data that we use for inventory management, billing, and tracking organizational data.
Until recently, I had been using Python scripts to simulate an read-only API for querying K1000. It largely relied on custom MySQL queries to the database backend of the K1000 and was difficult to maintain. With version 7.x of the product, Dell Kace finally introduced a badly needed REST API to read and modify almost every aspect of the K1000.
While that sounds all well and good, there have been a number of pitfalls which include the following:
- Lack of documentation
- Lack of programmatic examples
- Lack of support for anything related to the APIs
Let me clarify lack of support by saying that Dell Kace will support the functionality of the APIs; however, they will not assist a developer in testing or validating their code which may be using the APIs.
After some trial and error, I was able to connect to the API and perform various operations; however, some of the operations failed to function resulting in an "API Disabled" error. The following APIs seemed to be impacted:
- Asset Module
- Scripting Module
- Managed Installation Module
After consulting Quest Software / Dell Kace Support, and asking them not to test or validate my code, but to verify that my appliance's API was functional, I received the following information from support:
Set the HTTP header to use "x-dell-api-version: 5"
I had been setting this header variable to 1 instead of 5 since this was the initial release of the API. It appears that different API endpoints have different version requirements. Do not make the same assumption that I did. Upon making this change, all of my issues went away and I was receiving data.
If you are having trouble communicating with the API based on the documentation, but you can authenticate successfully, make sure you construct a session cookie in your code. If you're using Python, most modules, like 'requests', will do all of the work for you.