RUT955/956/240/241 Reset Config to factory default through JSON RPC

As the topic asks, is there an available json rpc command that would allow me to reset the router?

I am currently running the following commands:

firstboot -y
reboot

as recommended by openWRT: [OpenWrt Wiki] Failsafe mode, factory reset, and recovery mode

but the reboot command sent as a linux command does not reply before the reboot occurs, and handling the curl errors in this case is a pain. Is there an existing command that replies before the reboot occurs?

Hello,

I’d recommend initiating the reboot of the device using the following call:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "call",
    "params": [
        "$session_id",
        "vuci.system",
        "reboot",{}
    ]
}

This call utilizes UBUS interface, which can be used to control most of the device functions. To get all possible UBUS calls, run the following command:

ubus -v list

And the ubus calls can be performed by specifying the UBUS sub-system and the command, followed by the arguments:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "call",
    "params": [
        "<session_id>",
        "<subsystem>",
        "<command>",
        {
            "arg1": "value1",
            "arg2": "value2"
        }
    ]
}

Where:

  • Session ID - token generated with the initial call

  • Subsystem - the UBUS subsystem (e.g. network.interface.wan)

  • Command - the command of the subsysem:

Hope this helps!

Best regards,

1 Like

thank you, this is very helpful!

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.