Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

Security

Reply
Highlighted

Trying to set a static IP

Techie
Posts: 4
9298     0
I'm just starting to use the Infoblox WAPI. I'm trying to set it up so I can call the WAPI from my ASP.NET application to set a static IP given an IP and a MAC address. I tried to run the following two commands through the Chrome REST console, but both came back with "Error": "AdmConProtoError: Unknown object type" (Assume the infoblox server name is "infoblox") https://infoblox/wapi/v1.0/record:host -d '{"ipv4addrs":[{"configure_for_dhcp": false, "ipv4addr": "10.222.0.15"}], "configure_for_dns": false}' https://infoblox/wapi/v1.0/record: host_ipv4addr -d '{"ipv4addr":"10.222.0.15","configure_for_dhcp":false,"mac":"01:23:45:01:23:45"} What am I doing wrong? Which command should I be using?
Highlighted

Name required

Employee
Employee
Posts: 15
9299     0

Reading the WAPI 1.2.1 Docs for NIOS 6.8.5 under Support-->Download it indicates that a "name" is required on create.  See page 415-416 for CURL examples (make sure the zone and network exists first):

curl -k3 -u admin:testpw -H "Content-Type: application/json" \

-X POST https://192.168.1.2/wapi/v1.2.1/record:host -d \

’{"ipv4addrs":[{"ipv4addr":"10.222.0.12"}],"name":"host.zone.com"}’

Highlighted

WAPI 1.2.1

Employee
Employee
Posts: 15
9299     0

Ah,

  I also see that you are using WAPI 1.0.  There are lots of new features in 1.2.1 if you can get your NIOS up to 6.8.4.

Hope this helps,

Brad

Highlighted

No change

Techie
Posts: 4
9299     0
I tried adding a name, and still got the error: "Error": "AdmConProtoError: Unknown object type (record:host {\"ipv4addrs\":[{\"ipv4addr\": \"10.222.0.15\"}], \"name\": \"Test\"})", "code": "Client.Ibap.Proto", "text": "Unknown object type (record:host {\"ipv4addrs\":[{\"ipv4addr\": \"10.222.0.15\"}], \"name\": \"Test\"})"
Highlighted

Content-type?

Employee
Employee
Posts: 15
9299     0

Are you able to set the content-type in your ASP.net call, it should be set to JSON format: "Content-Type: application/json". Also, make sure you are doing a POST vs. GET.  Were you able to run it against V1.2.1 - https://infoblox/wapi/v1.2.1/record:host?

Can you try it from CURL on the command line to verify it works and then we can dig into how to make it work in ASP.net?

Highlighted

Curl errors

Techie
Posts: 4
9299     0
I tried running it from curl, and it gave me: { "Error": "AdmConProtoError: JSON Decoding: No JSON object could be decoded", "code": "Client.Ibap.Proto.JSONDecoding", "text": "JSON Decoding: No JSON object could be decoded" } curl: (3) [globbing] unmatched close brace/bracket in column 13 curl: (6) Could not resolve host: name curl: (3) [globbing] unmatched close brace/bracket in column 15
Highlighted

Fixed

Techie
Posts: 4
9299     0

We got it figured out.  First, we upgraded to WAPI V1.4.  Then, we used the following code:

Dim objHTTP = CreateObject("MSXML2.serverXMLHTTP")

        Dim strEnvelope = "ipv4addr=" & TextBox2.Text & "&mac=" & TextBox1.Text & "&comment=" & TextBox3.Text & "&name=" & TextBox4.Text

        objHTTP.SetOption(2, 13056)
        objHTTP.Open("POST", ("https://infoblox/wapi/v1.4/fixedaddress"), False, strUsername, strPassword)

        objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")

        objHTTP.send(strEnvelope)

        Label3.Text = objHTTP.responseText

Highlighted

if you want to create a

Community Manager
Community Manager
Posts: 248
9299     0

if you want to create a static ip, don't create a 'record:host', just create a 'fixedaddress' object.

you can do this with the v1.2 api, you don't need to use v1.4

if you set the mac address to '00:00:00:00:00:00', it will create a reservation.

Highlighted

Re: if you want to create a

Techie
Posts: 11
9299     0

Thanks, this works great! Do you know how I can set the Unlimited Lease Time field on the reservation? When I retreive the object and try to update the 'never_ends' field I get the following error...

 

AdmConProtoError: Operation update not allowed for lease

Showing results for 
Search instead for 
Do you mean 

Recommended for You