Question about managing SMA devices with API
Hi,
I have more than 1000 servers in my company, all in KACE SMA. I need to update information on all of them and I can't afford doing it manually one by one.
I am trying to use the API to do it with scripting.
I have been able to login to the server and get a list of devices running the following command:
Invoke-RestMethod -uri https://server/api/inventory/machines -Headers $baseHeaders -Method Get -WebSession $apisession -SkipCertificateCheck | ConvertTo-Json
I get an output with all machines, each one something like this:
{
"Id": 5427,
"Modified": "2025-05-23 04:47:07",
"Created": "2020-07-13 11:45:16",
"User": "someuser",
"Name": "device name",
"Ip": "Device IP",
"Os_name": "Microsoft Windows Server 2016 Datacenter x64",
"Os_number": "10.0.14393",
"Last_inventory": "2025-05-23 04:47:07",
"Last_sync": "2025-05-23 04:47:07",
"Ram Total": "65536 Bytes",
"Ram_used": 63275.8,
"Ram_max": "65536",
"Bios_identification_code": "",
"Sound_devices": "",
"Cdrom_devices": "",
"Video_controllers": "Microsoft Basic Display Adapter:0 MB",
"Monitor": "Generic Non-PnP Monitor",
"Registry_size": "168",
"Registry_max_size": "4095",
"Pagefile_size": "475",
"Pagefile_max_size": "475",
"Manual_entry": 0
}
But I need to update the following fields:
Asset Location
Assigned To
Status
Owner
Department.
But none of those fields appear in the results got with the request
I have tried also with /api/asset/assets/ but there, I don't find the computers.
Can anybody point me to the right direction?
Answers (2)
It sounds to me like you could actually do the update from a CSV import into your assets?? I usually find trying to update anything via the API is a bit of a minefield!!
if you have the data in a spreadsheet bear in mind you must have the device name to upload data.
if you have your inventory and asset linked via a custom serial number field, you can use that as a primary key to make sure the correct data is added to the correct asset.
Top Answer
Where can I find guidance to do as import from CSV? I don't have devices and assets linked custom serial number field. We have devices and assets with same names for asset and device.
Comments:
-
Contact me, I would be happy to spend 30 mins to teach you how to import. - Hobbsy 2 weeks ago