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

    Create dynamic host address through API

    Scheduled Pinned Locked Moved General
    3 Posts 2 Posters 323 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.
    • F Offline
      fa__
      last edited by

      Hello,

      I would like to create a Host Address through the API that includes DHCP allocation.
      I only have been able to create Host Adresseses marked as static. I have no issues setting the assignment I choose in the web interface.
      The attribute "ipv4_assignment" only accepts the values in the dialog "IP: Assignment" () but regardless of the value I send, the Host Address is always static.

      This is one of my attempts to https://demo.i-doit.com

      {
          "version": "2.0",
         "method": "cmdb.category.save",
          "params": {
              "object": 1412,
              "category": "C__CATG__IP",
              "data": {
                  "net": 20,
                  "ipv4_assignment": "DHCP"
              },
              "apikey": "c1ia5q",
              "language": "en"
          },
          "id": 1
      }
      
      Michael HuhnM 1 Reply Last reply Reply Quote 0
      • Michael HuhnM Offline
        Michael Huhn @fa__
        last edited by

        Hello @fa__,

        you can set the dialog field "ipv4_assignment" via API but you need to add the net_type, too.
        Like :

        {
        	"jsonrpc": "2.0",
        	"method": "cmdb.category.save",
        	"params": {
        		"object": 1122546692,
        		"category": "C__CATG__IP",
        		"data": {
        			"net_type": "IPv4 (Internet Protocol v4)",
        			"net": 20,
        			"ipv4_assignment": "DHCP"
        		}
        	},
        	"apikey": "apikey",
        	"language": "en",
        	"id": 1
        }
        
        F 1 Reply Last reply Reply Quote 0
        • F Offline
          fa__ @Michael Huhn
          last edited by

          Thanks @michael-overkamp!
          It works fine.

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