Wed May 16, 2018 7:01 pm
Surrounding multiple commands on the command line with "{" and "}" and/or separating them with ";" isn't really combining them into one. The router still treats them as independent commands... I mean, you can't really combine commands into one call even on CLI, and thus not on API.
You could make one call to "/system/script/add" to add a temp script, and a second call to "/system/script/run" to run that script. Within the script, you'd add all of your firewall rules or whatever else normally takes too long on the API, and remove the script itself when you're done. Thus, you'd combine many calls into just two (or three if you make the script removal not part of the temp script).
OR you could use an API client that lets you make multiple API calls without waiting for their replies (with tags). This lets you send multiple add requests all at once. They'll still only be committed to the router after you get the corresponding reply, but because you already sent the "next" reply before waiting for the first one's reply, the operation will be faster.
My API client implements both possibilities with Util::exec() and Client::sendAsync(), respectively. Not all clients (in general) support the second option, but the first can be easily made with any API client, even if it isn't as convenient as a simple method call in the language.