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

    Linking two objects together via API

    Scheduled Pinned Locked Moved Development
    2 Posts 2 Posters 497 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!

      I alredy have an API that will create a new object for a client within I-DoIt, however I would like to expand is so that the new client is assigned to a contact.

      I have played around with with cmdb.category.create method, but keep getting the error:

      "message=Invalid parameters: Object id invalid. ID must be positive and higher than two"

      As a test I try to update a category with the cmdb.category.save method and get the same message. I am using Powershell to do this, my code so far is:

      $parameter = @{
              "category" = "C__CATS__PERSON_CONTACT_ASSIGNMENT"
              "apikey" = $APIKey
              "language" = "en"
              "object" = 9217
              "data" = @{
                  "objID" = 14131
                  "description" = "Computer"
                  }      
              
              }
      
      $Commands = @{
          "jsonrpc" = "2.0"
          "method" = "cmdb.category.create"
          "params" = $parameter
          "id" = 1
      }
      
      Invoke-RestMethod -uri xxxxxxxx -ContentType application/json -Method Post -Body ($Commands | ConvertTo-Json ) -Headers @{ Authorization = $Auth}
      
      
      

      I know I am missing something, but can't find anything in the documentation to help me further

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

        Hello @SHQuinn4Com,

        short and painless 😆

        cmdb.category.save = Key -> object
        cmdb.category.create = Key -> objID

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