Hello everyone, I'm having trouble doing a curl set configuration using ubus to update my disabled value of wireless interface. Anyone can give me an example? I always receive the status code [2] => Invalid Argument
My steps:
curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "00000000000000000000000000000000", "session", "login", { "username": "root", "password": secret } ] }' url
curl -s -d '{"jsonrpc":"2.0","id":1,"method":"call","params": [UBUS_SESSION ,"uci","get",{"config": "'wireless'", "section": "'radio0'", "option":"'disabled'"}]}' -g url
curl -s -d '{"jsonrpc":"2.0","id":1,"method":"call","params": [UBUS_SESSION ,"uci","set",{"config": "'wireless'", "section": "radio0", "option":"disabled", "values":"1"}]}' -g url
What I'm doing wrong? I cant get a new ubus session and get disabled value but i cant set a new value..
jow
May 31, 2017, 1:52pm
2
Hi, for the set
operation use this payload:
{
"jsonrpc": "2.0",
"id": 1,
"method": "call",
"params": [
"UBUS_SESSION",
"uci",
"get",
{
"config": "wireless",
"section": "radio0",
"values": {
"disabled": 0
}
}
]
}
Alternatively drop the disabled
option entirely using the delete
call with this payload:
{
"jsonrpc": "2.0",
"id": 1,
"method": "call",
"params": [
"UBUS_SESSION",
"uci",
"delete",
{
"config": "wireless",
"section": "radio0",
"options": [
"disabled"
]
}
]
}
Thank you so much! It worked!
It doenst work anymore... I was doing
curl -s -d '{"jsonrpc":"2.0","id":1,"method":"call","params":
["'$UBUS_SESSION'","uci","set",{"config":"'teste_wireless'","section":"'radio0'",
"values": { "disabled":1}}]}' -g http://[2016:900d:c0de::1022]:80/ubus
But it had no effect in my device when i do a uci commit
curl -s -d '{"jsonrpc":"2.0","id":1,"method":"call","params":
["'$UBUS_SESSION'","uci","commit",{"config":"'teste_wireless'"}]}' -g
http://[2016:900d:c0de::1022]:80/ubus
In documentation (https://wiki.openwrt.org/doc/techref/ubus ) for uci set we had
uci set { "package": "package",
"section": "sname",
"option": "oname",
"value": "value" }
Can you help me?
Udbv
May 3, 2018, 7:56am
5
Worked on lede 17.01
1)Make changes
{ "jsonrpc": "2.0",
"id": {{$timestamp}},
"method": "call",
"params": [
"{{session_id}}", "uci", "set", {"config": "wireless","section":"sta", "type":"@wifi-iface","values": {
"disabled": 0 }}
]
}
2)Commit them
{ "jsonrpc": "2.0",
"id": {{$timestamp}},
"method": "call",
"params": [
"{{session_id}}", "uci", "commit",{"config":"wireless"}
]
}
3)Reload changed interfaces
{ "jsonrpc": "2.0",
"id": {{$timestamp}},
"method": "call",
"params": [
"{{session_id}}", "network", "reload",{
}
]
}