Reply

Create host record with Protected enabled option via API calls

New Member
Posts: 1
2453     0

Hi,

We are trying to make use of Infoblox to create hosts using powershell script.We are able to create record but we wanted the record to be created with Protected enabled.

 

Issue: Record is not created in Protected enabled

 

Is there any example how to create host record with Protected enabled option via API calls?

Thanks in Advance,

 

This is the script which i am using

$url = "https://x.x.com/wapi/v2.11/record:host?_return_as_object=1"
$host_details = @{
name="Servername.domain.com"
ipv4addrs=@(@{ipv4addr="10.0.0.0"})
ddns_protected="true"}#This line is not working
$body = $host_details| ConvertTo-Json
Invoke-RestMethod -Uri $url -Method POST -Credential $creds -ContentType 'application/json' -Body $body

 

Best Regards

Bramandla Sumithra

Re: Create host record with Protected enabled option via API calls

Superuser
Posts: 65
2454     0

From some quick testing, it seems the "true" is being read as a string instead of boolean. I wasn't able to alter this while using the ConvertTo-Json cmdlet. Here is a script that worked for me, without using ConverTo-Json:

$url = "https://x.x.com/wapi/v2.11/record:host?_return_as_object=1"
$body = "{
`n	`"name`":`"servername.domain.com`",
`n    `"ddns_protected`":true,
`n	`"ipv4addrs`":
`n	[
`n		{
`n			`"ipv4addr`":`"10.0.0.0`"
`n		}
`n	]
`n}"
Invoke-RestMethod -Uri $url -Method POST -Credential $creds-ContentType 'application/json' -Body $body

Re: Create host record with Protected enabled option via API calls

Authority
Posts: 24
2454     0

Try

ddns_protected=$true}

Showing results for 
Search instead for 
Did you mean: 

Recommended for You