Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
JG1
New Contributor

Fortimanager JSON REST API: Adding a new entry to webfilter : Syntax ?

I am on v5.2.2-build0706 150415 (GA) and using FMG::JSONAPI. I have successfully obtained an existing list of URLs and parsed it to a format I wanted. I would now like to add a new URL to an existing URL list "our-web-filter".  I have the following test code per the example in the documentation from "perldoc FMG::JSONAPI":

 

my @newobjects = ( { name => 'our-web-filter' , 'id' => 1, 'url' => 'zzzzz.com', 'action' => 1, 'type' => 0, 'status' => 1 } );

my $response = $jsonapi->add("pm/config/adom/root/obj/webfilter/urlfilter", \@newobjects);

 

Here's part of existing urllist obtained from fmg with "GET", dumped with Data::Dumper:

 

 

$VAR1 = [
          {
            'id' => 1,
            'comment' => '',
            'name' => 'our-web-filter',
            'entries' => [
                           {
                             'url' => 'bridge-technology.com',
                             'action' => 1,
                             'type' => 0,
                             'status' => 1,
                             'obj seq' => 1
                           },
...

 

Is there anything obviously wrong with the "add" code?

 

Is there a "dry-run" method for testing with this tool?

 

Any help would be much appreciated.

 

0 REPLIES 0
Labels
Top Kudoed Authors