JSON-RPC API - Callback in JSON format?

Hello folks,

I am trying to understand the method list_all (pat, cb) and list_installed (pat, cb) from luci.model.ipkg.

According to the documentation:

  • pat: Only find packages matching this pattern, nil lists all packages
  • cb: Callback function invoked for each package, receives name, version and description as arguments.

In this case, how can I represent cb for a JSON request?

My current JSON request body:

{
	"method": "list_all",
	"params": [
		"nil", "nil"
	]
}

JSON-RPC API Response:

{
    "id": null,
    "result": null,
    "error": null
}

Thanks

cb should be a function. Are you asking how you can represent function for a JSON request?

Thanks replying.
Yes, that is what I am looking for.

It's not possible. In general I suggest to avoid using the old LuCI RPC interface at all and to utilize the ubus HTTP gateway instead.

Thanks, jow. That helps me a lot.

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