All examples below assume the frame below:
{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ $sessid, "uci", $method, $params ] }
I'll just list the values for $method and $params.
List all existing configs:
$method = "configs"
$params = { }
Get the complete network config:
$method = "get"
$params = { "config": "network" }
Get all sections of type interface:
$method = "get"
$params = { "config": "network", "type": "interface" }
Get all sections of any type that have proto set to dhcp:
$method = "get"
$params = { "config": "network", "match": { "proto": "dhcp" } }
Get a specific option of a named section:
$method = "get"
$params = { "config": "network", "section": "wan", "option": "ifname" }
Get an entire named section:
$method = "get"
$params = { "config": "network", "section": "wan" }
Get named or unnamed sections using extended lookup format (@type[idx] notation):
$method = "get"
$params = { "config": "network", "section": "@interface[0]" }
Add a new anonymous section:
$method = "add"
$params = { "config": "network", "type": "route", "values": { "interface": "wan", "target": "1.2.3.0/24", "gateway": "5.6.7.8" } }
Add a new named section:
$method = "add"
$params = { "config": "network", "name": "wwan", "type": "interface", "values": { "proto": "dhcp" } }
Set value in a named section:
$method = "set"
$params = { "config": "network", "name": "wan", "values": { "proto": "static", "ip6addr": "fdca:1234::1/64" } }
Set values in all sections of given type:
$method = "set"
$params = { "config": "network", "type": "interface", "values": { "auto": 0 } }
Set values in all matching sections (set option auto 0 on all interfaces with proto dhcp):
$method = "set"
$params = { "config": "network", "type": "interface", "match": { "proto": "dhcp" }, "values": { "auto": 0 } }
Delete named section:
$method = "delete"
$params = { "config": "network", "section": "wan" }
Delete two options in a section:
$method = "delete"
$params = { "config": "network", "section": "wan", "options": [ "auto", "ip6addr" ] }
Delete all sections of a given type:
$method = "delete"
$params = { "config": "network", "type": "route" }
Delete all interfaces with proto "dhcpv6":
$method = "delete"
$params = { "config": "network", "type": "interface", "match": { "proto": "dhcpv6" } }
Rename a section (config interface wan -> config interface wan_bak):
$method = "rename"
$params = { "config": "network", "section": "wan", "name": "wan_bak" }
Rename an option (option ifname -> option ifname_bak):
$method = "rename"
$params = { "config": "network", "section": "wan", "option": "ifname", "name": "ifname_bak" }
Reorder sections:
$method = "order"
$params = { "config": "network", "sections": [ "loopback", "lan", "wan", "wan6", "@route[0]", "@route[1]" ] }
Dump all staged changes:
$method = "changes";
$params = { }
Dump all staged changes in network:
$method = "changes";
$params = { "config": "network" }
Same for revert + commit.
See also "ubus -v list uci" for the method signatures. More detailled comments in http://nbd.name/gitweb.cgi?p=luci2/rpcd … =HEAD#l329 downwards.