API

From Wiki of WFilter NG Firewall
(Difference between revisions)
Jump to: navigation, search
(Links)
 
(2 intermediate revisions by one user not shown)
Line 5: Line 5:
 
WFilter NGF has a built-in API library for developers to manipulate the entire system or integrate WFilter features. With APIs, you’re able to:
 
WFilter NGF has a built-in API library for developers to manipulate the entire system or integrate WFilter features. With APIs, you’re able to:
  
1. Monitor system/network status.
+
* 1. Monitor system/network status.
2. Monitor bandwidth and online users.
+
* 2. Monitor bandwidth and online users.
3. Set client access policy.
+
* 3. Set client access policy.
  
 
Available APIs are listed in below:
 
Available APIs are listed in below:
Line 88: Line 88:
 
* Function: rm_user
 
* Function: rm_user
 
* Paramter: ip or username(urlencoded)
 
* Paramter: ip or username(urlencoded)
 +
 +
= Add, modify and delete settings =
 +
== Load settings ==
 +
* Function: config_load
 +
* cfgname: config file name
 +
* Return: json format settings
 +
 +
== Add settings ==
 +
* Function: config_add
 +
* Parameters
 +
** cfgname: config file name
 +
** type: settings type
 +
** name: settings section name
 +
** values: json format settings content
 +
 +
== Modify settings ==
 +
* Function: config_set
 +
* Parameters
 +
** cfgname: config file name
 +
** section: settings section name
 +
** values: json format settings content
 +
 +
== Delete settings ==
 +
* Function: config_del
 +
* Parameters
 +
** cfgname: config file name
 +
** section: settings section name
 +
 +
== Apply changes ==
 +
* Function: config_apply
 +
* Parameter: none
  
 
= SDK Download =
 
= SDK Download =
Line 94: Line 125:
  
 
= Links =
 
= Links =
* [http://blog.wfilterros.com/?p=520 API overview of WFilter NGF]
+
* [http://blog.wfilterngf.com/?p=520 API overview of WFilter NGF]
* [http://blog.wfilterros.com/?p=313 Integrate paypal payment with your ISP service.]
+
* [http://blog.wfilterngf.com/?p=313 Integrate paypal payment with your ISP service.]

Latest revision as of 13:55, 12 July 2019


Contents

[edit] 1 Introduction

WFilter NGF has a built-in API library for developers to manipulate the entire system or integrate WFilter features. With APIs, you’re able to:

  • 1. Monitor system/network status.
  • 2. Monitor bandwidth and online users.
  • 3. Set client access policy.

Available APIs are listed in below:

[edit] 2 Network Status

[edit] 2.1 List network interfaces

  • Function: get_network_interfaces
  • Parameter: none
  • Return: JSON
  • Result format

[edit] 2.2 Get interface status and statistics

  • Function: get_network_status
  • Parameter: none
  • Return: JSON
  • Result format

[edit] 3 Bandwidth and user status

[edit] 3.1 Get bandwidth history of past N seconds

  • Function: list_bandwidth
  • Parameter: seconds
  • Return: JSON
  • Result format

[edit] 3.2 List online users

  • Function: list_online_users
  • Parameters: return rows(max 1000), search string
  • Return: JSON
  • Result format

[edit] 3.3 List online connections of a client

  • Function: list_online_connections
  • Parameter: IP address
  • Return: JSON
  • Result format

[edit] 4 Get Basic Settings

[edit] 4.1 List groups

  • Function: list_group
  • Parameter: none
  • Return: JSON
  • Result format

[edit] 4.2 List WFilter accounts

  • Function: list_account
  • Parameter: none
  • Return: JSON
  • Result format

[edit] 5 Set client access policy

[edit] 5.1 Terminate connections(kick off user)

  • Function: kill_connection
  • Parameters:
    • port : connection local port, 0 for all ports
    • type: "ALL"-- all protocols, "RESET"-- reset to default, "REMOVE"-- bypass all blocking, others -- protocol name.
    • minutes: blocking minutes
    • message: message to be displayed(urlencoded)
  • Return: TRUE or FALSE

[edit] 5.2 Add IP into a virtual group

  • Function: add_virtual_group
  • Parameters:
    • groupid: group ID
    • ip: client IP
    • minutes: stay in this group for N minutes
  • Return: TRUE or FALSE

[edit] 5.3 Remove IP from a virtual group

  • Function: rm_virtual_group
  • Paramter: IP
  • Return: TRUE or FALSE

[edit] 5.4 Connect IP with username

  • Function: add_user
  • Parameters
    • ip: ip address
    • user: username(urlencoded)
    • from: from type(eg: webauth, pppoe)
    • expire: expire after N seconds
  • Return: TRUE or FALSE

[edit] 5.5 Disconnect ip with username

  • Function: rm_user
  • Paramter: ip or username(urlencoded)

[edit] 6 Add, modify and delete settings

[edit] 6.1 Load settings

  • Function: config_load
  • cfgname: config file name
  • Return: json format settings

[edit] 6.2 Add settings

  • Function: config_add
  • Parameters
    • cfgname: config file name
    • type: settings type
    • name: settings section name
    • values: json format settings content

[edit] 6.3 Modify settings

  • Function: config_set
  • Parameters
    • cfgname: config file name
    • section: settings section name
    • values: json format settings content

[edit] 6.4 Delete settings

  • Function: config_del
  • Parameters
    • cfgname: config file name
    • section: settings section name

[edit] 6.5 Apply changes

  • Function: config_apply
  • Parameter: none

[edit] 7 SDK Download

[edit] 7.1 php

Download URL: WFilter SDK for php

[edit] 8 Links

Personal tools
Namespaces

Variants
Actions
Navigation
Tools