Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    Creating Clients via API

    Scheduled Pinned Locked Moved Operating
    2 Posts 2 Posters 458 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      SHQuinn4Com
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • Michael HuhnM Offline
        Michael Huhn
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post