Reply

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

[ Edited ]
Posts: 7
2196     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

Moderator
Moderator
Posts: 315
2197     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: 7
2197     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 ]
Moderator
Moderator
Posts: 315
2197     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: 7
2197     0

greats. That is a much cleaner solution! Thx

Showing results for 
Search instead for 
Did you mean: 

Recommended for You