Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API Examples

Reply

WAPI: How to delete only one record:host_ipv4addr from a record:host object

Posts: 7
719     0

Hi,

 

I'm wondering if there is a way to delete only one ipv4addr of a record:host object? For example I have following object (perl's Data :: Dumper representation):

 

$VAR1 = [
          {
            'ipv6addrs' => [
                             {
                               'ipv6addr' => '2001:db8::1',
                               'host' => 'host-9.privat',
                               'configure_for_dhcp' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
                               '_ref' => 'record:host_ipv6addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQucHJpdmF0Lm51Zi5zZGEudGJrLTkuMjAwMTpkYjg6OjEu:2001%3Adb8%3A%3A1/host-9.privat/default'
                             }
                           ],
            'name' => 'host-9.privat',
            '_ref' => 'record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LnByaXZhdC5udWYuc2RhLnRiay05:host-9.privat/default',
            'ipv4addrs' => [
                             {
                               'mac' => '00:19:99:00:00:00',
                               '_ref' => 'record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQucHJpdmF0Lm51Zi5zZGEudGJrLTkuMTAuMy4yMDAuOS4:10.3.200.9/host-9.privat/default',
                               'configure_for_dhcp' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
                               'ipv4addr' => '10.3.200.9',
                               'host' => 'host-9.privat'
                             },
                             {
                               'host' => 'host-9.privat',
                               'ipv4addr' => '10.3.200.11',
                               'configure_for_dhcp' => $VAR1->[0]{'ipv6addrs'}[0]{'configure_for_dhcp'},
                               '_ref' => 'record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQucHJpdmF0Lm51Zi5zZGEudGJrLTkuMTAuMy4yMDAuMTEu:10.3.200.11/host-9.privat/default'
                             }
                           ],
            'extattrs' => {
                            'Audit' => {
                                         'value' => 'add host - Mon Feb  6 12:27:15 2023'
                                       }
                          }
          }
        ];

I want to delete only the record:host_ipv4addr object with the ipv4addr 10.3.200.11 and not the whole record:host object

Re: WAPI: How to delete only one record:host_ipv4addr from a record:host object

Posts: 7
719     0

the record:host_ipvaddr cant be deleted because there is a restriction on delete. There is a ipv4address object what can be deleted.

 

To solve my problem I have to get the _ref of a ipv4address object with the ip_address 10.3.200.3:

 

https://<url>/wapi/v2.11.3/ipv4address?ip_address=10.3.200.9

Then I'm able to generate following content for the URL: 

https://<url>/wapi/v2.11.3/request

 

[{
      "method" : "DELETE",
      "object" : "ipv4address/Li5pcHY0X2FkZHJlc3MkMTAuMy4yMDAuOS8w:10.3.200.9"
}]
Showing results for 
Search instead for 
Did you mean: 

Recommended for You