Does anyone have a real world example of using the API?
I am trying to learn how to use the KACE API, but the given documentation is scanty, at best. Has anyone used the API successfully? I am trying to use Postman to test the API. Any help would be most appreciated.
Answers (3)
What version of the SMA?
What programming language are you familiar with and plan to use to make the API calls?
There are examples available in previous posts, you may want to search to see if a previous post contains an example in the programming language you plan to use.
What do you want to accomplish with the API?
Not sure what programming language I will end up using. Right now I am more concerned about successfully executing a call to the API. To do this I am using the Postman application.
Version:
Model: K1000
Hardware Model: Virtual (VMware/Hyper-V/Nutanix)
Version: 12.1.169
In the end I hope to create a parent ticket and then various child tickets.
Top Answer
Postman can be used to test the API on 12.1.
The API has been available since at least SMA version 9.0 and has been successfully used by customers.
You start with the login API call in postman. Make sure to have enabled API for the SMA and the user on the SMA.
Once you have successfully logged in, you may make other API calls.
POST <Your SMA IP or hostname>/ams/shared/api/security/login
// Add headers in postman
Content-Type: application/json
Accept: application/json
x-kace-api-version: 8
// Body content in postman using your credentials
{
"userName": "admin",
"password": "password",
"organizationName": "Default"
}
Comments:
-
This worked from the standpoint that I actually got a response, but that response was "Invalid user or password", so I've got a little ways to go. Do you need to be an administrator to use the API? - chrisamaru 1 year ago
-
You do not need to be an admin. However, you will need to set the values for the userName and password to valid credentials on the SMA. - KevinG 1 year ago
-
I did set those values to the credentials I use when I login to work on tickets. It said they were invalid. - chrisamaru 1 year ago
-
I guess you have to be very exact. You can't use "username", you have to use "userName". Once I got that right, I was logged in. Just have to figure out how to use the API to open a ticket. - chrisamaru 1 year ago
-
I'm not sure what I'm doing wrong, but when I try to do a call to the API that is supposed to create a ticket, I get an Unauthorized response. My call to the login API is successful and I get the bearer token. I add that as a x-kace-csrf-token header in the create ticket API. Does anybody have any insight into what might be going wrong? - chrisamaru 1 year ago