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
389 views 4 comments
by anonymous

Hi,

I have just upgraded the RUT950 to FW 07.02.04 and it seems like the json-rpc session id returns [6]  (as has already been mentioned in JSON-RPC). Are there any plans of fixing this or a workaround?

Thanks 

1 Answer

+1 vote
by anonymous
Hello,

Could you share the body of you POST request to check?

Best regards,
by anonymous

router_url = "http://"+ip_addr+"/ubus"
payload = {
"method": "call",
"params": ["00000000000000000000000000000000", "session", "login",\
{
"username":self.router_user, "password":self.router_pass
}],
"jsonrpc": "2.0",
"id": 1,
}
self.session_id = None

try:
    response = requests.post(router_url, json=payload, timeout=0.5).json()
    self.session_id = response["result"][1]["ubus_rpc_session"]

with the response being: 

{u'jsonrpc': u'2.0', u'id': 1, u'result': [6]}

 

by anonymous

"params": ["00000000000000000000000000000000""session""login" should be without \ at the end;

In the line "username":self.router_user"password":self.router_pass

append username and password in "" and use admin as a username as in the following:

"username":"admin""password":"self.router_pass"

by anonymous

@ZygimantasBliu thanks for the quick response but this is not the issue here. The backslash is used to break a line in python and we receive a response anyways. The request works perfectly on FW 06.08.05 but not on the 07.02.04. Could you please confirm whether the JSON-RPC works on the latest FW as a similar behaviour was JSON-RPC

EDIT: You are right about the username, it should be admin instead of root.

Many thanks

by anonymous

It does work. Tested on RUT9_R_00.07.02.7, using Postman app returns the following: