RUT240 JSON-RPC not working the same in newer FW

Communicating via json from my device to RUT240 worked in RUT2XX_R_00.01.14.5
After upgrading to RUT2_R_00.07.06.11 the same code does not work anymore.

I send:
{

"jsonrpc":"2.0", "id":1, "method":"call", "params":
[
    "00000000000000000000000000000000", "session", "login",
    {
        "username":"root", "password":"myPW"
    }
]

}

before i got the answer:

{‘jsonrpc’: ‘2.0’, ‘id’: 1, ‘result’: [0, {‘ubus_rpc_session’: ‘dbafd1102148e601c806cbcb9a2a62f2’, ‘timeout’: 300, ‘expires’: 299, ‘acls’: {‘access-group’: {‘superuser’: [‘read’, ‘write’], ‘unauthenticated’: [‘read’]}, ‘ubus’: {‘‘: [’’], ‘session’: [‘access’, ‘login’]}, ‘uci’: {‘*’: [‘read’, ‘write’]}}, ‘data’: {‘username’: ‘root’}}]}

after the upgrade I get:

{‘jsonrpc’: ‘2.0’, ‘id’: 1, ‘result’: [6]}

This is a real showstopper for my application. I need to support both older end upgraded firmware already out in the field. What to do?

Ubus ACLs are probably missing in the new firmware. Since there needs to be explicitly defined allowed commands for JSON RPC interface, you can read more about it here [OpenWrt Wiki] ubus (OpenWrt micro bus architecture).

Also I suggest to not use JSON RPC as Teltonika has moved away from it in their web interface, there might be more limitations. Instead use the API, documentation can be found at https://developers.teltonika-networks.com/.

Thanks a lot.
I got this to work: (had to use admin instead of root)
curl -X POST “http://192.168.1.1/api/login
-H “Content-Type: application/json”
-d ‘{“username”: “admin”, “password”: “myPW”}’

Now I only have to figure out how to call gsmctl in this format

Hello,

I’ve just tested it with the RUT240 (firmware version RUT2_R_00.07.06.11) and everything is working fine. I’ve attached the screenshots for your reference. Please review to ensure the correct code is written to obtain the session ID and to get gsmctl parameters.

Hope this helps!

Best Regards,

Thanks for the testing.
I find that i have two problems.

  1. In the old code the user root is used, not admin. Back when this was written, admin didn’t work.

  2. In params it’s written like: “-Sl all”, but now you have to write “-Sl”, “all”

        "command":"gsmctl",
        "params":
        [
            "-Sl", "all"
        ]

Again, thank you for your help.

You are welcome, and I apologize for any inconvenience these changes may have caused. Over time, some functions and commands change and improve, and we strive to make these adjustments as beneficial and convenient as possible for all our clients. If you have any questions or concerns, please feel free to share them with us by posting on our community forum.

As I understand it, the issue is now resolved. Is there anything else related to this topic that you would like to address?

Best Regards,

Yes Marija, I think this is solved for now. I have a lot of scripts to update and will post again if I need more helt.

Regards,
Lars.