API call using ubus module

Hello Everyone,
I want to use ubus module for fetching data from the manager and send the updated data to the manager in OpenWrt GUI. right now we are using default UCI methods to send and receive data. Can we use ubus module for whole data communication between GUI and Application Manager.

Thanks in Advance.

Likely yes. For any more elaborate answer you'll need to provide more details and context.

We created a page Cellular have 3 text field and one drop down. all values can update by the user. right now we are using CBI map to update the config file (m =Map("cbi_celltab")). I need to send this data to its application manager(middleware) when i click the save button using UBUS. how can i achieve this?
also i need to fetch the current data from the manager when load the page using UBUS.
Please check screenshot of the page attached.

Hi All,
When i tried to communicate with UBUS using below code :

conn:call("AGENT", "cellular_set", ' {"Username": "dasds","Password": "23123123","SimPin": 1234,"NetworkSelection": 0 } ' )

I am getting an ERROR. Please help me in this.

bad argument #3 to 'call' (table expected, got string)

As the error says, the 3rd argument is expected to be a table, not a string. You're passing a string containing the code for a JSON object.

Use this instead:

conn:call("AGENT", "cellular_set", {
    Username = "dasds",
    Password = "23123123",
    SimPin = 1234,
    NetworkSelection = 0
})
1 Like

This is Working!! Thanks Jow..

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.