Reply
Highlighted
Accepted Solution

How to Create reservations with REST and PowerShell

Panzerbjrn
Techie
Posts: 3
2549     0

Instead of creating Host entries, we create IPv4 reservations - Data Management->DHCP->SubNet->Add->Reservation

 

I would like to do this via PowerShell but have been unable to find anything that explains how to do it.

 

Reading the code in the most excellent module "Posh-IBWAPI" (Available from the PowerShell gallery), as well as The Definitive Guide To Rest Examples (https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214)  I have figured out a lot about how to manipulate Infoblox with REST; except for how to create IPv4 DHCP Reservations.

 

I realise this could also be a case of not knowing the terminology as I am not super au fait with Infoblox.

 

Any direct links to this specific information or code examples would be very much appreciated.

Re: How to Create reservations with REST and PowerShell

Adviser
Posts: 100
2550     0

Hi,

 

You can do this by creating a fixed address reservation.

 

Here is a sample curl command. You can modify it according to your need.

curl -k -u admin:Infoblox -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.9/fixedaddress?_return_fields%2B=ipv4addr,mac&_return_as_object=1" -d '{"ipv4addr":"172.26.1.200","mac":"00:00:00:00:00:00"}'

Hope this is helpful,

Krishna

Re: How to Create reservations with REST and PowerShell

Panzerbjrn
Techie
Posts: 3
2550     0

Hi Kvasudevan,

 

Thanks, but as I don't know curl, it isn't really useful for me, but thanks for trying.

Re: How to Create reservations with REST and PowerShell

Adviser
Posts: 100
2550     0

Hi,

 

Here is a powershell code snippet

$url = "https://127.0.0.1/wapi/v2.9/fixedaddress?_return_fields%2B=ipv4addr,mac&_return_as_object=1"
$pwd = ConvertTo-SecureString "Infoblox" -AsPlainText -Force
$creds = New-Object Management.Automation.PSCredential ('admin', $pwd)
$reservation_details = @{
  ipv4addr="172.26.1.100"
  mac="00:00:00:00:00:00"}
$body = $reservation_details | ConvertTo-Json
Invoke-RestMethod -Uri $url -Method POST -Credential $creds -ContentType 'application/json' -Body $body

Re: How to Create reservations with REST and PowerShell

Panzerbjrn
Techie
Posts: 3
2550     0

Thanks, that looks like something I recognise and can put into our environment. :-)

Showing results for 
Search instead for 
Do you mean 

Recommended for You