Reply
Highlighted

Requesting Syntax for curl command to add MS Servers to Network

[ Edited ]
DStachour
Techie
Posts: 3
2122     0

Hi, I'm trying to set 2 Microsoft appliances as the only 2 Managed Members on a network, so that I can create a DHCP Scope with a MS DHCP Failover association. Here's what I've done so far...

 

After reading the RESTful guide and working with the curl syntax, I'm very close to being able to add MS DHCP Servers to the Network using the following command. Please help with the syntax as I can't afford to make these change in the GUI (too time consuming). Here's what I've got so far.

 

I can easily see a network with this command:

curl -k1 -uusername:password -X GET https://10.25.7.31/wapi/v1.7.5/network -d network=10.25.4.0/22

 

And I can easily set the simple comment field on that same network with this command:

curl -k1 -u username:password -X PUT https://10.25.7.31/wapi/v1.7.5/network/ZG5zLm5ldHdvcmskMTAuMC4wLjAvMjQvMA:10.0.0.0/24/default -d comment~:=Test-Coresite

 

However, when I try to set the MSDhcpMember on the network (I tried 2 different ways), I get the following syntax error (I don't know how to correctly specify the List value for the members field):

 

 

First syntax attempt: 

curl -k1 -uusername:password -X PUT https://10.25.7.31/wapi/v1.7.5/network/ZG5zLm5ldHdvcmskMTAuMC4wLjAvMjQvMA:10.0.0.0/24/default -d members="ipvr4addr:10.34.0.59" 

{ "Error": "AdmConProtoError: List value expected for field: members",

  "code": "Client.Ibap.Proto",

  "text": "List value expected for field: members"

 

 

 

Second syntax attempt:

curl -k1 -uusername:password -X PUT https://10.25.7.31/wapi/v1.7.5/network/ZG5zLm5ldHdvcmskMTAuMC4wLjAvMjQvMA:10.0.0.0/24/Pearson -d members='[{"_struct": "msdhcpmember", "ipv4addr": "10.34.0.59", "iv6addr": null, "name": "usicd-ta-dhcp1.pedev.com"}]' 

{ "Error": "AdmConProtoError: List value expected for field: members",

  "code": "Client.Ibap.Proto",

  "text": "List value expected for field: members"

 

Thanks in advance for your help as I think that I'm very close!

Re: Requesting Syntax for curl command to add MS Servers to Network

[ Edited ]
Adviser
Posts: 98
2123     0

Yes I think you're very close.  Be sure to tell it there's JSON content, and be sure to fully enclose the JSON in curly brackets.   You should only need to give it the MS Servers' IP address.  And that MS Server must already be configured in the grid.

 

If you also have a DHCP range in this network, you will also need to assign the MS Server to the range, in the same way.  (for just fixed addresses, you might not have a range)

 

Try this:

 

curl -k1 -u username:password -H 'Content-Type: application/json' -X PUT https://10.25.7.31/wapi/v1.7.5/network/ZG5zLm5ldHdvcmskMTAuMC4wLjAvMjQvMA:10.0.0.0/24/Pearson -d '{"members": [{"_struct": "msdhcpserver","ipv4addr": "10.34.0.59" }]}'

 

Re: Requesting Syntax for curl command to add MS Servers to Network

DStachour
Techie
Posts: 3
2123     0

MRichard, thanks for your reply and your code almost worked, and here is the error that I received.

 

{ "Error": "AdmConDataError: unknown MS server 10.34.0.59",
"code": "Client.Ibap.Data",
"text": "unknown MS server 10.34.0.59"

 

I honestly think that it should have worked since if I use the GUI to add that same MS Server (I triple checked the IP address) it works just fine

 

Infoblox MS Server Add.JPGMS Server Added Via GUI

Can you, or anyone, think of a reason why this code isn't working? Does it need another variable passed? Some other issue?

 

Thanks again in advance for your help, it is very appreciated!

Re: Requesting Syntax for curl command to add MS Servers to Network

DStachour
Techie
Posts: 3
2123     0

I was able to add a normal Infoblox appliance, using the following command, successfully using the struct of dhcpmember, so the syntax is correct.

 

curl -k1 -u admin:infoblox -H 'Content-Type: application/json' -X PUT https://10.25.7.31/wapi/v1.7.5/network/ZG5zLm5ldHdvcmskMTAuMC4wLjAvMjQvMA:10.0.0.0/24/Pearson  -d '{"members": [{"_struct": "dhcpmember","ipv4addr": "10.25.4.111" }]}'

My only conclusion is that for some reason my MS DHCP Servers, which are managed by the Grid, do not appear to be MS DHCP servers using the RESTful API. I can add those same MS DHCP Servers via the GUI just fine, just not using my curl command. I've tried this same command both in our production v6.12.28 Grid and my test v8.2.2 Grid, with the same result.

 

Does anyone have any ideas as to why this isn't working via the API?

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You