Reply

Creating a new network block and filling in various options using WAPI

PLussier
Techie
Posts: 9
1726     0

With existing networks in the Web UI there is a link (labelled "member assignment") in the edit dialog which allows me to assign this network to Grid Members.  How do I assign a network upon creation to grid members using the WAPI ? To take this question to it's logical conclusion, how do I assign ANY of the options on the left of this dialog using the WAPI ?

Documentation on the WAPI seems rather lacking in this regard, though the far too few examples using 'curl' are fantastic.  If you can please provide answers with examples using curl I'd greatly appreciate it!

 

Thanks,

Paul

When creating or updating

GHorne Community Manager
Community Manager
Posts: 248
1727     0

When creating or updating objects with the REST api, you often have to send complex data structures that don't translate well into a set of name-value pairs.

So your best approach is to always send a JSON formatted data structure in the body of the message and make sure you use the right headers, like this:

curl -k -X POST 'https://admin:infoblox@192.168.1.2/wapi/v1.1/network' \
    -H "Content-Type: application/json" \
    -d "{'network':'10.10.10.0/24'}"

If you want to add members to the network, you have to add a member struct:

"members": [ 
    { 
        "_struct": "dhcpmember", 
        "ipv4addr": "192.168.1.2", 
        "name": "localhost.infoblox" 
    }
 ] ,

Thus

curl -k -X POST 'https://admin:infoblox@192.168.1.2/wapi/v1.1/network' \
-H "Content-Type: application/json" \
-d "{
   'network':'10.10.10.0/24'
   'members': [ 
     { 
        '_struct': 'dhcpmember', 
        'ipv4addr': "192.168.1.2', 
        'name': "localhost.infoblox' 
     }
    ]
   }"

 

Oh, and all that JSON has to be quoted correctly, and then wrapped as a single quoted string for the '-d'. so tread carefully

Awesome!  Thanks!

PLussier
Techie
Posts: 9
1727     0

Awesome!  Thanks!

Showing results for 
Search instead for 
Do you mean 

Recommended for You