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

    Kategorie erstellen mit category.save

    Scheduled Pinned Locked Moved Entwicklung
    2 Posts 1 Posters 369 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.
    • A Offline
      ajoel
      last edited by ajoel

      Hallo zusammen,
      ich möchte Netze (C__CATS__NET) via JSON-RPC automatisiert erstellen lassen. Das klappt auch gut, mit der Methode cmdb.category.create allerdings bekomme ich da die Meldung dass diese Methode veraltet sei und ich stattdessen cmd.category.save benutzen soll. Für save finde ich aber nirgends eine Doku.

      Schicke ich folgenden JSON Request an .create funktioniert es. Bei .save bekomme ich eine Fehlermeldung, was den integer Wert der Object ID angeht. Was mache ich hier falsch?

      Request:

      {
          "jsonrpc": "2.0",
          "method": "cmdb.category.save",
          "params": {
              "apikey": "xxx",
      				"ObjID": 15371656,
      				"category": "C__CATS__NET",
      				"data": {
      					"address": "1.1.1.0",
      					"netmask": "255.255.255.0",
      					"range_from": "1.1.1.100",
      					"range_to": "1.1.1.175"
      				}
      		},
          "id": 1
      }
      

      Response:

      {
        "id": 1,
        "jsonrpc": "2.0",
        "error": {
          "code": -32099,
          "message": "i-doit system error: (object) ObjectId needs to be a integer value which references an existing object.",
          "data": null
        }
      }
      

      Die Object-ID ist korrekt.

      Hat jemand eine Idee?

      1 Reply Last reply Reply Quote 0
      • A Offline
        ajoel
        last edited by

        Ich habs gefunden.

        Aus irgendeinem Grund wurde bei der .save Methode der Parameter ObjID in object umbenannt. Folgender Request funktioniert dann auch:

        {
            "jsonrpc": "2.0",
            "method": "cmdb.category.save",
            "params": {
                "apikey": "xxx",
        				"object": 15371656,
        				"category": "C__CATS__NET",
        				"data": {
        					"address": "1.1.1.0",
        					"netmask": "255.255.255.0",
        					"range_from": "1.1.1.100",
        					"range_to": "1.1.1.175"
        				}
        		},
            "id": 1
        }
        
        1 Reply Last reply Reply Quote 0

        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
        • First post
          Last post