Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps


How do i update Network DHCP options using WAPI?

Posts: 9
780     0

I'm am writing a script to resize a subnet and need to update the Routers option and an extensible attribute.

The resize works fine as well as the attribute update, however i am stuck on updating the Routers field.

I use postman to test then write in python and I can't find a solution for this using either.


Since we are updating an existing network, i'm assuming this is going to be a PUT request.  I am also assuming, like the Perl API, that the options have to be added as a whole, not as individual options.

 Anyone have any insight on this?

 I have tried a few different things and am coming up empty with a 400 Bad Request error.   Postman with the same data gives me "AdmConProtoError: Input is not an object"

        # 6. Change dhcp options
        -> GET https://lab-gm/wapi/v2.10.5/network?network=\
        Update "routers"
            "name": "routers",
            "num": 3,
            "use_option": true,
            "value": "",
            "vendor_class": "DHCP"
        # TODO - Not currently working
        iotvlanopts = iotvlanoutput[0]['options']
        # print(iotvlanopts)
        for options in iotvlanopts:
            for key, value in options.items():
                if value == 'routers':
                    print("Updating default gateway")
                    options.update({"value": ""})
                if key == 'use_option':
                    options.update({"use_option": "True"})
        # newopts = json.dumps(iotvlanopts)
        newopts = iotvlanopts
        optsupdate = api_put(baseurl + '/' + iotvlanref, newopts, ibapauth_cookie, debug)
        if optsupdate.status_code !=
            error_msg = 'Error {} updating default gateway: {}'
            print(error_msg.format(optsupdate.status_code, optsupdate.reason))
            success_msg = 'Default Gateway updated {}'

Re: How do i update Network DHCP options using WAPI?

New Member
Posts: 1
780     0

Did you ever get this working? 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You