Get Virtualizor

Add Firewall Plan

API Description

This API is used to add Firewall Plan from Enduser side.

Parameters

Sample Code

 <?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $enduser = new Virtualizor_Enduser_API($ip, $key, $pass);

    $output = $post = [];

    $post['fwp_name'] = 'Test SSH';
    $post['default_policy'] = 'DROP';
    $post['fwp_note'] = 'Test Firewall';
    $post['api_firewall_rules'] = [["4", "IN" ,"ACCEPT" ,"TCP" ,"22,567", "192.168.1.10"],
                                ["4", "IN", "ACCEPT","TCP","80","0.0.0.0/0"]];

    $output = $enduser->addfirewallplan($post);
    print_r(json_encode($output));

Output

{
  "done": {
    "msg": "Firewall Plan added successfully",
    "goto": "act=firewallplan"
  }
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list