8298 questions

9759 answers

15542 comments

13863 members

0 votes
264 views 2 comments
by

Is there a way to create a file using jsonrpc, I have been trying some weird stuf

{

    "jsonrpc": "2.0", "id": 1, "method": "call", "params": 

    [

        "000000000", "file", "exec",

        {

            "command":"echo",

            "params":

            [

                "1",

                ">",

                "test.txt"

            ]

        }

    ]

}

1 Answer

0 votes
by

Hi, you will need to use this POST request for JSON-RPC:

{

    "jsonrpc":"2.0", "id":1, "method": "call", "params":

    [

        "00000000000000", "file", "write", 

        {

            "path":"/filepath.txt",

            "data":"TextYouWantInYourFile",

        }

    ]

}

Best answer
by
Thank you, this worked. Is there a place I can find documentation and examples about all the available commands? I can find just few documentated in wiki.
by

Hi,

Source of more complex ubus usage can be found here: https://openwrt.org/docs/techref/ubus

EB.