| Both sides previous revision Previous revision | |
| docs:guide-developer:ubus:uci [2024/11/08 06:22] – Minor updates ivan98 | docs:guide-developer:ubus:uci [2024/11/08 06:33] (current) – Minor updates ivan98 |
|---|
| | ''uci'' | ''configs'' | ''{ }'' | <WRAP>List all available configs | | ''uci'' | ''configs'' | ''{ }'' | <WRAP>List all available configs |
| |
| Return messages: | Example: |
| - ''{ "configs": [ "config1", "config2", ... ] }'' | <code> |
| | # ubus call uci configs '{"ubus_rpc_session":"2db687f321a60414e77677bbb5dd6d6f"}' |
| | { |
| | "configs": [ |
| | "dhcp", |
| | "dropbear", |
| | "firewall", |
| | "luci", |
| | "network", |
| | "radius", |
| | "rpcd", |
| | "system", |
| | "ubootenv", |
| | "ucitrack", |
| | "uhttpd", |
| | "wireless" |
| | ] |
| | } |
| | </code> |
| </WRAP> | | </WRAP> | |
| | ''uci'' | ''get'' | ''{ "config": "//config//", | | ''uci'' | ''get'' | ''{ "config": "//config//", |
| - ''{ "//oname//": "value1" }'' | - ''{ "//oname//": "value1" }'' |
| - ''{ "//oname//": [ "value1.1", ... ] }'' | - ''{ "//oname//": [ "value1.1", ... ] }'' |
| | |
| | Example: |
| | <code> |
| | # ubus call uci get '{"ubus_rpc_session":"2db687f321a60414e77677bbb5dd6d6f", "config":"wireless", "section":"wifinet2"}' |
| | { |
| | "values": { |
| | ".anonymous": false, |
| | ".type": "wifi-iface", |
| | ".name": "wifinet2", |
| | "device": "radio0", |
| | "mode": "ap", |
| | "ssid": "ilwf-guest", |
| | "encryption": "sae-mixed", |
| | "key": "XXXX", |
| | "network": "lan", |
| | "disabled": "0" |
| | } |
| | </code> |
| </WRAP> | | </WRAP> | |
| | ''uci'' | ''state'' | ''{ "config": "//config//", | | ''uci'' | ''state'' | ''{ "config": "//config//", |
| - If there already is a section called ''//sname//'': ''UBUS_STATUS_INVALID_ARGUMENT'' else: ''UBUS_STATUS_OK'' | - If there already is a section called ''//sname//'': ''UBUS_STATUS_INVALID_ARGUMENT'' else: ''UBUS_STATUS_OK'' |
| - If there is no section ''//sname//'' or if ''//value//'' is neither a string nor an array: ''UBUS_STATUS_INVALID_ARGUMENT'' else: ''UBUS_STATUS_OK'' | - If there is no section ''//sname//'' or if ''//value//'' is neither a string nor an array: ''UBUS_STATUS_INVALID_ARGUMENT'' else: ''UBUS_STATUS_OK'' |
| | |
| | Example: |
| | <code> |
| | # ubus call uci set '{"ubus_rpc_session":"2db687f321a60414e77677bbb5dd6d6f", "config":"wireless", "section":"wifinet2", "values":{"disabled":"1"}}' |
| | # ubus call uci get '{"ubus_rpc_session":"2db687f321a60414e77677bbb5dd6d6f", "config":"wireless", "section":"wifinet2"}' |
| | { |
| | "values": { |
| | ".anonymous": false, |
| | ".type": "wifi-iface", |
| | ".name": "wifinet2", |
| | "device": "radio0", |
| | "mode": "ap", |
| | "ssid": "ilwf-guest", |
| | "encryption": "sae-mixed", |
| | "key": "XXXXXXXX", |
| | "network": "lan", |
| | "disabled": "1" |
| | } |
| | } |
| | </code> |
| </WRAP> | | </WRAP> | |
| | ''uci'' | ''add'' | ''{ "config": "//config//", | | ''uci'' | ''add'' | ''{ "config": "//config//", |