For detailed descriptions on how to use the JSON-RPC API, please refer to the following links:
https://openwrt.org/docs/techref/ubus
https://github.com/openwrt/luci/wiki/JsonRpcHowTo
The listings below, along with additional scripts and packages can be found here:
In order to access the radio, you first need to set the permissions for your user profile (to be created next). Create a new profile /usr/share/rpcd/acl.d/superuser.json like the one below.
Next, create a user profile in /etc/config/rpcd, and then restart the process with /etc/init.d/rpcd restart. An example profile is shown below.
The API is now ready to be used. You should adjust the user profile and permissions to your liking. The permissions above could pose a security risk. In order to use API, you need to get a session ID and use it for subsequent requests. For ubus, for example, you can try the following call,
the -k option is required because the Smart Radio doesn’t use a third party certificate authority. An example of using JSON-RPC API for file access is shown below. Substitute <TOKEN> with the value returned above.
}'