The KACE Systems Management Appliance (SMA) API allows you to manage various aspects of the KACE SMA appliance data and its related information. This article only covers basic instructions with connecting via Powershell 7 and is provided as one example of how to establish an initial connection. For additional information, please refer to the API Reference Guide, which is located in the technical documents page for the SMA.
NOTE: KACE Support is only able to assist with ensuring basic functionality of the API. For assistance with writing custom API, please contact Professional Services. This is a fee-based service.
Additional API related articles may be available in our knowledge base or on ITNinja
The following is an example of creating a connection via Powershell 7 to the KACE Systems Management Appliance (SMA) API. This also works on Microsoft's Visual Studio code, commonly referred to as VS Code, with the Powershell 7 extension installed.
To establish a connection with API:
$loginurl = 'https://KACESMAWEBURL/ams/shared/api/security/login'
# Common headers
$baseHeaders = @{
'Content-Type' = 'application/json'
'ACCEPT' = 'application/json'
'x-kace-api-version' = '5'
}
$loginbody = @{
'userName' = 'USER'
'password' = 'PASSWORD'
} | ConvertTo-Json
$restmethod = Invoke-RestMethod -Uri $loginurl -Headers $baseHeaders -Body $loginbody -Method Post -SkipCertificateCheck -SessionVariable apisession
2. After doing the initial login API call, you can do subsequent API calls using the URL for the API call as seen on the API reference guide. In the example below, a call was made for a specific asset, in this case, asset with ID 8
Please keep in mind that "-SkipCertificateCheck" has been used since the SMA is using a Self-Signed SSL certificate and Powershell will not connect because of SSL/TLS. If using a certificate from a valid Certificate Authority, then this should not be required.
© ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center