FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
585 views 2 comments
by anonymous

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 anonymous

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 anonymous
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 anonymous

Hi,

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

EB.