Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:ubus:uci [2018/02/17 17:13] – ↷ Page moved from doc:ubus:uci to docs:guide-developer:ubus:uci bobafetthotmaildocs:guide-developer:ubus:uci [2024/11/08 06:33] (current) – Minor updates ivan98
Line 1: Line 1:
-=====ubus uci=====+====== ubus uci =====
 + 
 +**Package: rpcd** 
 + 
 +<code># ubus -v list uci 
 +'uci' @4eb774a8 
 + "configs":{} 
 + "get":{"config":"String","section":"String","option":"String","type":"String","match":"Table","ubus_rpc_session":"String"
 + "state":{"config":"String","section":"String","option":"String","type":"String","match":"Table","ubus_rpc_session":"String"
 + "add":{"config":"String","type":"String","name":"String","values":"Table","ubus_rpc_session":"String"
 + "set":{"config":"String","section":"String","type":"String","match":"Table","values":"Table","ubus_rpc_session":"String"
 + "delete":{"config":"String","section":"String","type":"String","match":"Table","option":"String","options":"Array","ubus_rpc_session":"String"
 + "rename":{"config":"String","section":"String","option":"String","name":"String","ubus_rpc_session":"String"
 + "order":{"config":"String","sections":"Array","ubus_rpc_session":"String"
 + "changes":{"config":"String","ubus_rpc_session":"String"
 + "revert":{"config":"String","ubus_rpc_session":"String"
 + "commit":{"config":"String","ubus_rpc_session":"String"
 + "apply":{"rollback":"Boolean","timeout":"Integer","ubus_rpc_session":"String"
 + "confirm":{"ubus_rpc_session":"String"
 + "rollback":{"ubus_rpc_session":"String"
 + "reload_config":{} 
 +</code> 
 + 
 +<WRAP warning> 
 +The "ubus uci" section of this documentation is severely outdated and incomplete.  It is only useful nowadays as a starting point for someone to actually rewrite it to match reality. 
 +</WRAP>
  
 ^ Path ^ Procedure ^ Signature ^ Description ^ ^ Path ^ Procedure ^ Signature ^ Description ^
-| ''uci'' | ''get'' | ''{ "package": "//package//",+| ''uci'' | ''configs'' | ''{ }'' | <WRAP>List all available configs 
 + 
 +Example: 
 +<code> 
 +# ubus call uci configs '{"ubus_rpc_session":"2db687f321a60414e77677bbb5dd6d6f"}' 
 +
 + "configs":
 + "dhcp", 
 + "dropbear", 
 + "firewall", 
 + "luci", 
 + "network", 
 + "radius", 
 + "rpcd", 
 + "system", 
 + "ubootenv", 
 + "ucitrack", 
 + "uhttpd", 
 + "wireless" 
 +
 +
 +</code> 
 +</WRAP>
 +| ''uci'' | ''get'' | ''{ "config": "//config//",
   "section": "//sname//",   "section": "//sname//",
   "type":    "//type//",   "type":    "//type//",
   "option":  "//oname//" }'' | <WRAP>Return the requested uci value(s), all arguments are optional.   "option":  "//oname//" }'' | <WRAP>Return the requested uci value(s), all arguments are optional.
-  - When called without argument or with empty object: return an array of package names in the ''packages'' field +  - When called without argument or with empty object: return an array of package names in the ''configs'' field 
-  - When called with ''//package//'' set: return an object containing all sections containing all options in a field named after the package +  - When called with ''//config//'' set: return an object containing all sections containing all options in a field named after the package 
-  - When called with ''//package//'' and ''//type//'' set: return an object containing all sections of type ''//type//'' containing all options in a field named after the package +  - When called with ''//config//'' and ''//type//'' set: return an object containing all sections of type ''//type//'' containing all options in a field named after the package 
-  - When called with ''//package//'' and ''//sname//'' set: return an object containing all options of the section in a field named after the section +  - When called with ''//config//'' and ''//sname//'' set: return an object containing all options of the section in a field named after the section 
-  - When called with ''//package//'' and ''//type//'' and ''//oname//'' set: return an object containing the value of each option named ''//oname//'' within a section of type ''//type//'' in a field named after the matched section+  - When called with ''//config//'' and ''//type//'' and ''//oname//'' set: return an object containing the value of each option named ''//oname//'' within a section of type ''//type//'' in a field named after the matched section
   - When called with ''//package//'' and ''//sname//'' and ''//oname//'' set: return the result string in a field named ''//oname//'' in case of options or an array of result strings in a field named ''//oname//'' in case of list options   - When called with ''//package//'' and ''//sname//'' and ''//oname//'' set: return the result string in a field named ''//oname//'' in case of options or an array of result strings in a field named ''//oname//'' in case of list options
  
 Return messages: Return messages:
-  - ''{ "packages": [ "package1", ... ] }'' +  - ''{ "//config//": {
-  - ''{ "//package//": {+
   "sname1": {   "sname1": {
     ".type":   "type1",     ".type":   "type1",
Line 21: Line 68:
     "option2": [ "value2.1", ... ],     "option2": [ "value2.1", ... ],
     ... }, ... } }''     ... }, ... } }''
-  - ''{ "//package//": {+  - ''{ "//config//": {
   "sname1": {   "sname1": {
     ".type":   "//type//",     ".type":   "//type//",
Line 38: Line 85:
     - ''{ "//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'' | ''set'' | ''{ "package": "//package//",+| ''uci'' | ''state'' | ''{ "config": "//config//", 
 +  "section": "//sname//", 
 +  "type":    "//tname//", 
 +  "option":  "//oname//" }'' | |s 
 +| ''uci'' | ''set'' | ''{ "config": "//config//",
   "section": "//sname//",   "section": "//sname//",
-  "option":  "//oname//", +  "type":  "//tname//", 
-  "value":   "//value//" }'' | <WRAP>Set the given value(s), the option argument is optional. +  "values":   "//array_of_values//" }'' | <WRAP>Set the given value(s), the option argument is optional. 
-  - When called with ''//package//'' and ''//sname//'' and ''//value//'' set: add a new section ''//sname//'' in ''//package//'' and set it to the type given in ''//value//'' +  - When called with ''//config//'' and ''//sname//'' and ''//array_of_values//'' set: add a new section ''//sname//'' in ''//config//'' and set it to the type given in ''//tname//'' 
-  - When called with ''//package//'' and ''//sname//'', ''//oname//'' and ''//value//'' set+  - When called with ''//config//'' and ''//sname//'', ''//oname//'' and ''//array_of_values//'' set ''array_of_values'' as values in ''//sname//''
-    - If ''//value//'' is of type array: set strings in the ''value'' array as list option ''//oname//'' +
-    - If ''//value//'' is of type string: set ''//value//'' as normal option ''//oname//''+
 The call does not produce any data, instead it returns with the following status codes: The call does not produce any data, instead it returns with the following status codes:
   - 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'' | ''{ "package": "//package//",+| ''uci'' | ''add'' | ''{ "config": "//config//",
   "type":    "//type//" }'' | <WRAP>Add new anonymous section of given type.   "type":    "//type//" }'' | <WRAP>Add new anonymous section of given type.
-  - When called with ''//package//'' and ''//type//'' set: Add a new anonymous section of type ''//type//''.+  - When called with ''//config//'' and ''//type//'' set: Add a new anonymous section of type ''//type//''.
  
 Return message: Return message:
   - ''{ "section": "sectionname" }''   - ''{ "section": "sectionname" }''
 </WRAP> | </WRAP> |
-| ''uci'' | ''delete'' | ''{ "package": "//package//",+| ''uci'' | ''delete'' | ''{ "config": "//config//",
   "section": "//sname//",   "section": "//sname//",
   "type":    "//type//",   "type":    "//type//",
   "option":  "//oname//" }'' | <WRAP>Delete the given value(s) or section(s), the option and type arguments are optional.   "option":  "//oname//" }'' | <WRAP>Delete the given value(s) or section(s), the option and type arguments are optional.
-  - When called with ''//package//'' and ''//type//'' set: delete all sections of type ''//type//'' in ''//package//'' +  - When called with ''//config//'' and ''//type//'' set: delete all sections of type ''//type//'' in ''//config//'' 
-  - When called with ''//package//'' and ''//sname//'' set: delete the section named ''//sname//'' in ''//package//'' +  - When called with ''//config//'' and ''//sname//'' set: delete the section named ''//sname//'' in ''//config//'' 
-  - When called with ''//package//'', ''//type//'' and ''//oname//'' set: delete the option named ''//oname//'' within each section of type ''//type//'' in ''//package//'' +  - When called with ''//config//'', ''//type//'' and ''//oname//'' set: delete the option named ''//oname//'' within each section of type ''//type//'' in ''//package//'' 
-  - When called with ''//package//'', ''//sname//'' and ''//oname//'' set: delete the option named ''//oname//'' in section ''//sname//'' of ''//package//''+  - When called with ''//config//'', ''//sname//'' and ''//oname//'' set: delete the option named ''//oname//'' in section ''//sname//'' of ''//package//''
  
 The call does not result in any data, instead it returns the following status codes: The call does not result in any data, instead it returns the following status codes:
Line 73: Line 160:
   - If the option named ''//oname//'' within named section ''//sname//'' was not found: ''UBUS_STATUS_NOT_FOUND'' else: ''UBUS_STATUS_OK''   - If the option named ''//oname//'' within named section ''//sname//'' was not found: ''UBUS_STATUS_NOT_FOUND'' else: ''UBUS_STATUS_OK''
 </WRAP> | </WRAP> |
 +| ''uci'' | ''rename'' | ''{"config":"String","section":"String","option":"String","name":"String" }'' | |
 +| ''uci'' | ''order'' | ''{"config":"String","sections":"Array" }'' | |
 +| ''uci'' | ''changes'' | ''{"config":"String" }'' | |
 +| ''uci'' | ''revert'' | ''{"config":"String" }'' | |
 +| ''uci'' | ''commit'' | ''{"config":"String" }'' | |
 +| ''uci'' | ''apply'' | ''{"rollback":"Boolean","timeout":"Integer" }'' | |
 +| ''uci'' | ''confirm'' | ''{ }'' | |
 +| ''uci'' | ''rollback'' | ''{ }'' | |
 +| ''uci'' | ''reload_config'' | ''{ }'' | |
 +
  
  • Last modified: 2018/02/17 17:13
  • by bobafetthotmail