Das Erstellen von Clients per API
-
Hallo zusammen,
Ich bin relativ neu in i-doit und versuche, ein Powershell-Skript zu machen, das neu installierte Windows-Systeme automatisch in i-doit erstellt. Für den Teil der Übertragung des neuen Computers in i-doit habe ich das Folgende geschrieben:
$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}
Aber, ich bekomme immer wieder die untere Fehlermeldung:
"message=i-doit system error: (object) ObjectId needs to be a integer value which references an existing object"
Ich bin mir 100% sicher, dass das Objekt ID richtig ist, trotzdem funktioniert das Skript. Ich wäre seht dankbar, wann einer von euch das anschauen könnte.
Danke!
-
Hallo @shquinn4com
könntest du einmal den
$Bodyin seiner reinen JSON-Form posten? Ich könnte mir nur vorstellen das es ggf. Probleme aufgrund der Schreibweise gibt - du hastObjectgroß geschrieben.
Alternativ könntest du es mit der SchreibweiseobjIDprobieren.Viele Grüße
Leo
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login