- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Create host record with Protected enabled option via API calls
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 08:02 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 01:17 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2022 01:30 PM
Try
ddns_protected=$true}