Skip to main content
JG1
New Member
Apr 16, 2017 11:06 AM UTC
Question

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.

 

    Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024