Creating Clients via API
-
Hello everyone,
I am relatively new to i-doit and am trying to create a powershell script that will automatically enter newly installed Windows systems into i-doit in an effort to reduce human error. For the part of entering the new computer into i-doit I have written the below:
$Body = ConvertTo-Json @{
jsonrpc = "2.0";
method = "cmdb.category.save";
params = @{
apikey="our_api_key";
Object=10872;
category="C__CATG__MODEL";
data = @{
serial = "123wer123"
}
}
id="1"
}$Auth = "My_logon_Info"
Invoke-RestMethod -uri http://Our.idoit.domain//src/jsonrpc.php -ContentType application/json -Method Post -Body $Body -Headers @{ Authorization = $Auth}
However I keep getting the response that:
"message=i-doit system error: (object) ObjectId needs to be a integer value which references an existing object"
I am 100% sure that the object ID is correct, I also tried the ID number in both "" and without. Any ideas what the problem is?
Thanks!
-
Hello @SHQuinn4Com
the object with ID 10872 does exist in your CMDB?
Check if the object with ID 10872 exists .
Check if the ID 10872 is sent as integer.You could also check the API Log from i-doit