Reply
Accepted Solution

Update bootfile and bootserver for a selected host record

JBabiarz
Techie
Posts: 3
3744     0

Hello all I was hoping you could help me with a problem I am trying to solve. We run a wide variety of different operating systems I would like to be able to create host records while setting the bootserver and bootfile on the fly.  I am able to set almost every other option leveraging the wapi but continuosly get an error when trying to set bootfile and bootserver.  These are not the dhcp options, these are the are fields under object.

 

I am using powershell for my work but will gladly extrapolate from any functional example someone can provide.

 

Re: Update bootfile and bootserver for a selected host record

[ Edited ]
Authority
Posts: 27
3744     0

hello jbabiarz, 

 

hopefully the below will help?

 

POST /wapi/v2.5/record:host HTTP/1.1
Host: 192.168.86.111
Content-Type: application/json


{ "name":"hostwapi5.myzone.local",
"ipv4addrs":[
{
"ipv4addr":"1.1.1.205",
"configure_for_dhcp":true,
"mac":"00:de:ad:be:ef:02",
"bootfile":"mybootfile.cfg",
"bootserver":"1.2.3.4"
}

]
}

 

Kind regards

stephane

Re: Update bootfile and bootserver for a selected host record

JBabiarz
Techie
Posts: 3
3744     0

Thanks, I will give that whirl.  It looks very similar to what I have tested before which failed for me.

 

Also?  Is that a complete creation? Would I need to use the post method for updating an exisiting file instead of put?

 

I will report back with the results including the script I used.

 

 

Re: Update bootfile and bootserver for a selected host record

Authority
Posts: 27
3744     0

yes it was indeed a complete creation hence the usage of POST

(I did not try with updating an existing host record) 

Re: Update bootfile and bootserver for a selected host record

Authority
Posts: 27
3744     0

@JBabiarz wrote:

Would I need to use the post method for updating an exisiting file instead of put? 


 

I had the opportunity to quickly check this

 

1. created host with address 1.1.1.227 using the script shared previously

2. Update bootfile name using PUT (update existing object using its reference) - details below:

 

PUT /wapi/v2.5/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmxvY2FsLnNiZS5ob3N0d2FwaTI3 HTTP/1.1
Host: 192.168.86.111
Content-Type: application/json

(...snip'd)
{
"ipv4addrs":[
{
"ipv4addr":"1.1.1.227",

"bootfile":"myNEWbootfile.cfg"

}

]
}

 

hope this helps

stephane

 

 

Highlighted

Re: Update bootfile and bootserver for a selected host record

JBabiarz
Techie
Posts: 3
3744     0

This worked pefectly for me.  I am not sure why I was having issues as the format I was using was very similar.  I did not have  "configure_for_dhcp":true as in the past that seemed to be set automatically when I set a mac address.

 

Thanks again!!

Showing results for 
Search instead for 
Do you mean 

Recommended for You