Saturday, June 15, 2019

Action Batches in the Meraki Dashboard API

Just announced at Cisco Live '19 on this past Thursday is a new Meraki Dashboard API feature called Action Batches. This was announced during BRKRST-1733 on Thursday morning with Tony Carmichael and Shiyue (Shay) Cheng, two of Meraki's finest when it comes to their API. There's been some talk that this feature was coming, and I was very interested to see what the initial implementation was going to look like. Well, now that it's here we can take a look!

Let's back up a bit first and talk about a common pain point that I think nearly every Meraki API user has had. For certain tasks within the Dashboard API the only way to get things done was to make many separate calls for each item that you wanted to touch. For large jobs the amount of time that things took added up pretty quickly. Each API call can take between 0.5 and 3 seconds, so if you needed to make, say, 20 different calls you could be waiting up to a minute for your script to complete.

Take, for example, the task of creating a new network in the Dashboard as part of setting up a new site. You'd have to create the network (an API call), create a few VLAN for corp, guest, and contractors (an API call each) and the associated L3 FW rules to control traffic (again, an API call each), and then claim a device or three (you guessed it, an API call each).

You can see that even for a hypothetical example we're already at 10+ API calls, and we haven't looked at Group Policies, L7 FW rules, switch ports, etc.

Now, do this at scale for a new rollout of a thousand sites. Make sure you include the proverbial "grab a coffee" step in your MOP... This could take some time!

Luckily, we now have Action Batches to help us through this.

Here's the official documentation:

https://developer.cisco.com/meraki/api/#/rest/guides/action-batches

I'll let you peruse that in detail at you leisure for now. It's very detailed and outlines this new feature well. The basic idea is that you can now group multiple APi calls (up to 20 for a synchronous batch, up to 100 for an asynchronous batch) into one single API call called a batch. You simply submit the batch as one call, and prest-o change-o it executes and returns as a single call. Where this really makes an impact is the time the call takes to return. During the breakout session Shay manually made a call that configured a new network using much of the same configuration items I mentioned above rolled into a single call, and it all returned in just over one second.

I think you can understand why I'm excited about this now :)

I will try and get an example script up of my own in the next week showing some of what can be done with this.

Right now Action Batches doesn't support every call available in the Dashbaord API. During the breakout session Tony talked about expanding this new feature to eventually include other Dashboard API aspects, not just configuration. As with most everything Meraki, they are constantly expanding on what they've built so if you don't see an API call supported that you feel you could benefit from this, check back often as it's possible support for it will be added at some point. I know I'm looking forward to the addition of some of the more "monitoring" related APIs in addition to these "configuration" style calls.

That's all I got for now. Stay tuned for an example script shortly. Until then, it's time to review the config scripts and start turning them into Action Batches!

UPDATE: New Post up with the promised script! 








No comments:

Post a Comment