JSON-RPC "run_action" call

Hello

Can you please send me an example of how to set and action using the JSON PRC “run_action” api… Can this action api be run in a loop for multiple actions ?

Thanks

Hello,

The client sending an action has to wait for the result. You can have a loop that sends an action then waits for the results and loops over a list of actions that you have.

You can also send multiple actions without waiting for a result and correlate the results later. But know that they won’t be parallelized on the ConfD side.

You can handle this by creating multiple worker sockets on the server side in the data provider code.

You can send an action using JSON-RPC API like this:

curl
–cookie ‘sessionid=sess12541119146799620192;’
-X POST
-H ‘Content-Type: application/json’
-d ‘{“jsonrpc”: “2.0”, id: 1,
“method”: “run_action”,
“params”: {“th”: 2,
“path”: “/dhcp:dhcp/set-clock”,
“params”: {“clockSettings”: “2014-02-11T14:20:53.460%2B01:00”}}}’
http://127.0.0.1:8008/jsonrpc