Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API Examples

Reply

wapi: Invalid value for auto_create_reversezone: 0: Must be boolean type

[ Edited ]
Posts: 5
313     0

Hi,

 

I'm trying to add a network via the wapi. I use perl to communicate with the wapi. When I'm trying to POST following body to "https://<url>/wapi/v2.11.3/request":

 

[                                                 
   { 
      "method" : "POST",
      "object" : "network",                                        
      "data" : {                                           
         "network" : "10.4.3.0/24",                                                                                       
         "auto_create_reversezone" : 0,                         
      },                                                                              
   }
]                                       

I'm getting following error:

{ "Error": "AdmConProtoError: Invalid value for auto_create_reversezone: 0: Must be boolean type",
"code": "Client.Ibap.Proto",
"text": "Invalid value for auto_create_reversezone: 0: Must be boolean type"
}

Perl do not have boolean but its not perls fault, because the data structure is anyway converted to json

Re: wapi: Invalid value for auto_create_reversezone: 0: Must be boolean type

Community Manager
Community Manager
Posts: 184
314     0

The attribute/value pair for "auto_create_reversezone" is not required, as the default setting for this call is false, meaning it will NOT create the reverse zone automatically, by default.

 

But to fix this specific call, and for Infoblox REST in general, the boolean values are true or false, without surrounding quotes.

Re: wapi: Invalid value for auto_create_reversezone: 0: Must be boolean type

Posts: 5
314     0

Hi,

 

thank you for the quick and helpful answer. The problem is, perl don't have boolean variables. But I use the JSON module (lib) in Perl. The module is providing a  JSON->boolean(0) method, so the resulting JSON-Object is created as you mentioned in your answer with:

 

"auto_create_reversezone" : false,

Re: wapi: Invalid value for auto_create_reversezone: 0: Must be boolean type

[ Edited ]
Community Manager
Community Manager
Posts: 184
314     0

I get around that by using JSON::true and JSON::false.

 

For example, creating & pushing a DNS A record:

 

$record{"name"} = $fqdn;
$record{"ipv4addr"} = $obj->{"ipv4addr"};
$record{"view"} = $view;

if (defined $ttl)
{
$record{"use_ttl"} = JSON::true;
$record{"ttl"} = $ttl;
}

my $request = HTTP::Request->new(POST => "https://$ib_addr/$api/record:a");
$request->content_type('application/json');
$request->content($json->encode(\%record));
my $response = $ua->request($request);
my $msg = $response->{'_msg'};

Re: wapi: Invalid value for auto_create_reversezone: 0: Must be boolean type

Posts: 5
314     0

greats. That is a much cleaner solution! Thx

Showing results for 
Search instead for 
Did you mean: 

Recommended for You