Manage OpenWrt remotely (API) (where is the documentation?)

Hi.
I wanted to know how to remotely interface with openwrt to be able to manage it (perhaps with some python scripts). I saw that the API is available but here comes the problem. In my opinion not documented in detail (see rpc). I saw that there are two routes available: rpc and ubus. Question: What changes between the two?
I also took a look at the rpc api...documentation scattered around (mostly from other people and not an official OpenWrt guide) without "insights". Trivial example.

curl http://<hostname>/cgi-bin/luci/rpc/uci?auth=yourtoken --data '
{
  "method": "get_all",
  "params": [ "network" ]
}'

in the method field I imagine there are quite a few for each path (sys, fs, net, etc)... but where are they documented!? I've found practically nothing around other than example after example. If you could help me understand this situation a little better. Thank you

If you mean manage trough WAN the recommended solution is making a VPN tunnel to the router and from there connect to luci or ssh as usual.

I've found quite a bit: https://openwrt.org/docs/guide-developer/ubus and all the links from that page, in particular an excellent: https://openwrt.org/docs/techref/ubus

And this article seems to give a great overview: https://hackmd.io/@rYMqzC-9Rxy0Isn3zClURg/H1BY98bRw

I've found quite a bit

Thanks for the resource, but I meant RPC...

Isn't RPC a way to access ubus from other devices?

1 Like

The LuCI rpc api you quoted is outdated, undocumented and pretty much unmaintained. It predates the ubus over HTTP API LuCI itself is using.

Use the ubus HTTP gateway (http://192.168.1.1/ubus or the fallback http://192.168.1.1/cgi-bin/luci/admin/ubus). Method signatures match the ones discoverable via the local ubus -v list command