Skip to content

RESTful API v2 Specification ​

Authentication ​

The HTTP/HTTPS authentication should be used, for example with curl it is possible to specify username and password with -u <user>:<password>

Using HTTPS is recommended for security. See this post to enable HTTPS.

Request Format ​

Parameters can be provided both using GET with a query string or POST using JSON (in this case please make sure the correct Content Type is provided). For example, to download data for a host you can use the below curl command line using GET:

bash
curl -s -u admin:admin "http://192.168.1.1:3000/lua/rest/v2/get/host/data.lua?ifid=1&host=192.168.1.2"

or the below curl command line using POST:

bash
curl -s -u admin:admin -H "Content-Type: application/json" -d '{"ifid": "1", "host": "192.168.1.2"}' "http://192.168.1.1:3000/lua/rest/v2/get/host/data.lua"

Please check the Examples section for more examples.

Response Format ​

An API response is usually represented by a JSON message matching a standard structure. This JSON message consists of an envelope containing:

  • a return code rc
  • a human-readable string rc_str describing the return code
  • the actual response in rsp

Example:

text
{
 "rc": 0
 "rc_str": "OK",
 "rsp": {
    ...
 }
}

API ​

Interfaces ​

GET /lua/pro/rest/v2/get/nedge/interfaces.lua ​

Get nEdge interfaces

Description: Get all the network interfaces used by nEdge

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

GET /lua/pro/rest/v2/get/nedge/gateways/status.lua ​

Get gateways status information

Description: Read information about gateways

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

GET /lua/pro/rest/v2/get/nedge/physical/interface/data.lua ​

Get interface information

Description: Read information about an interface

Produces: application/json

Parameters

NamePositionDescriptionType
ifidqueryInterface identifierinteger

Responses

0 OK; -2 INVALID_INTERFACE; -3 NOT_GRANTED

GET /lua/pro/rest/v2/get/nedge/dhcp_active_leases.lua ​

Get DHCP leases

Description: Read active DHCP elases

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

POST /lua/pro/rest/v2/add/nedge/vlan/add_vlan.lua ​

Add a VLAN interface

Description: Add a VLAN interface

Produces: application/json

Parameters

NamePositionDescriptionType
interfaceformDataPhysical interfacestring
vlan_idformDataVLAN IDstring

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR

POST /lua/rest/v2/delete/nedge/vlan/remove_vlan.lua ​

Delete a VLAN interface

Description: Remove a VLAN interface

Produces: application/json

Parameters

NamePositionDescriptionType
delete_vlanformDataVLAN IDstring

Responses

0 OK; -3 NOT_GRANTED

Users ​

GET /lua/pro/rest/v2/get/nedge/users/status.lua ​

Get users stats

Description: Read traffic stats about users

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

Policy ​

POST /lua/pro/rest/v2/set/nedge/interface/state.lua ​

Enable or disable a WAN interface

Description: Set the state (enabled or disabled) of a WAN interface

Produces: application/json

Parameters

NamePositionDescriptionType
interfaceformDataWAN interface namestring
enabledformDataNew interface enable state: 'true' or 'false'string

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR; -7 BAD_FORMAT

GET /lua/pro/rest/v2/get/nedge/policy/default.lua ​

Get default policy for inter-LAN traffic

Description: Read default policy for inter-LAN traffic

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

POST /lua/pro/rest/v2/set/nedge/policy/default.lua ​

Set default policy for inter-LAN traffic

Description: Set default policy for inter-LAN traffic

Produces: application/json

Parameters

NamePositionDescriptionType
default_policyformDataPolicy: accept or denystring

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR; -7 BAD_FORMAT

GET /lua/pro/rest/v2/get/nedge/policy/rules.lua ​

Get rules for inter-LAN traffic

Description: Read all configured rules to allow/deny inter-LAN traffic

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

POST /lua/pro/rest/v2/add/nedge/policy/rule.lua ​

Add a policy for inter-LAN traffic

Description: Add a new policy for inter-LAN traffic and return the ID

Produces: application/json

Parameters

NamePositionDescriptionType
src_typeformDataSource type: 'cidr' or 'interface'string
src_valueformDataSource (e.g. '192.168.1.0/24' or 'eno2.11')string
dst_typeformDataDestination type: 'cidr' or 'interface'string
dst_valueformDataDestination (e.g. '192.168.1.0/24' or 'eno2.11')string
bidirectionalformDataBidirectionsl: 'true' or 'false'string
policyformDataPolicy: 'accept' or 'deny'string

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR

POST /lua/pro/rest/v2/edit/nedge/policy/rule.lua ​

Edit a policy by ID

Description: Change a policy rule by ID

Produces: application/json

Parameters

NamePositionDescriptionType
rule_idformDataRule ID to editstring
new_rule_idformDataNew Rule IDstring
src_typeformDataSource type: 'cidr' or 'interface'string
src_valueformDataSource (e.g. '192.168.1.0/24' or 'eno2.11')string
dst_typeformDataDestination type: 'cidr' or 'interface'string
dst_valueformDataDestination (e.g. '192.168.1.0/24' or 'eno2.11')string
bidirectionalformDataBidirectionsl: 'true' or 'false'string
policyformDataPolicy: 'accept' or 'deny'string

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR

POST /lua/rest/v2/delete/nedge/policy/rule.lua ​

Delete a policy rule

Description: Delete a policy rule by id

Produces: application/json

Parameters

NamePositionDescriptionType
rule_idformDataRule ID to deletestring

Responses

0 OK; -3 NOT_GRANTED

GET /lua/pro/rest/v2/get/nedge/forwarders.lua ​

Get broadcast/multicast forwarding rules

Description: Read all configured broadcast/multicast forwarding rules

Produces: application/json

Responses

0 OK; -3 NOT_GRANTED

POST /lua/pro/rest/v2/add/nedge/forwarder.lua ​

Add a rule for broadcast/multicast forwarding

Description: Add a new rule for broadcast/multicast forwarding

Produces: application/json

Parameters

NamePositionDescriptionType
repeater_typeformDataRepeater type (e.g. 'custom')string
ipformDataMulticast IP addressstring
interfacesformDataTrusted interfacesstring
interface_detailsformDatastring
restricted_interfacesformDataRestricted interfacesstring
restricted_interface_detailsformDatastring

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR

POST /lua/pro/rest/v2/edit/nedge/forwarder.lua ​

Edit a broadcast/multicast forwarding rule

Description: Edit a broadcast/multicast forwarding rules by ID

Produces: application/json

Parameters

NamePositionDescriptionType
repeater_idformDataRepeater rule IDstring
new_repeater_idformDataNew repeater rule IDstring
repeater_typeformDataRepeater type (e.g. 'custom')string
ipformDataMulticast IP addressstring
interfacesformDataTrusted interfacesstring
interface_detailsformDatastring
restricted_interfacesformDataRestricted interfacesstring
restricted_interface_detailsformDatastring

Responses

0 OK; -5 INVALID_ARGUMENTS; -6 INTERNAL_ERROR

POST /lua/rest/v2/delete/nedge/forwarder.lua ​

Delete multicast/broadcast forwarder rule

Description: Delete multicast/broadcast forwarder rule by id

Produces: application/json

Parameters

NamePositionDescriptionType
repeater_idformDataRepeater rule IDstring

Responses

0 OK; -3 NOT_GRANTED

nEdge ​

POST /lua/pro/rest/v2/set/nedge/interface/drop_host_flows.lua ​

Drop all active flows for the specified host

Description: Set flow verdict to drop for all active flows for the specified host

Consumes: application/json

Produces: application/json

Parameters

NamePositionDescriptionType
bodybodyJSON payloadobject

Responses

0 OK; -5 INVALID_ARGUMENTS

Documentation of the ntop open source tools.