Connecting to Meraki
Important security notice: Meraki has a security issue when you have access to more than one Meraki Customer. Because the API token is tied to a user account, and not to the accessed Meraki Customer, using your own personal API token is not appropriate.
For this reason, we strongly recommend that you create a dedicated "ReportMagic" user in your own domain (e.g. reportmagic@mymsp.com) and provide that user with access to only the required Meraki customers. You will also need to set up an API key for this user, which you can do by:
- In the top left hand corner of ReportMagic, click your profile picture
- Under API Tokens, click My API Tokens
- Click the Create button to enter the name, key and description for your dedicated API Token
Meraki Macros
ReportMagic has Meraki macros which provide information available via Meraki API calls.
To use [Meraki.XXX:] macros, set up a Meraki connection as follows:
- In ReportMagic's Admin menu, click Connections (or use the Admin app and click Connections)
- Click the Create button
- From the Type drop-down, select a Connection type of Meraki
- Enter a name - we recommend that you use "Default" for the name of the first connection of each type, and optionally, a description
- In the URL field, enter the API URL, for example, https://api.meraki.com
- In the User name field, enter N/A (as a value is required, but is ignored)
- In the Password field, enter one of the user's API Keys
- If you need to provide advanced configuration, for example to specify a region or apply rate limiting, you can use the Configuration field. See below for examples
- Click Save
Optional Configuration
You may enter additional configuration into the Configuration field. This is optional, and any items not set will cause the default values to be used.
The configuration must be entered as JSON (name and value pairs). The available options are:
-
ApiRegion - this is the API region used when connecting to Meraki. Options are:
- Canada
- China
- Default
- Government
- India
- ApiNode - the Meraki API Node (e.g. "n72"). This is optional but highly recommended as directly addressing the correct instance will reduce propagation delays. If this is NOT provided, you may experience HTTP not found (404) errors when accessing recently-added objects. [Default = not set]
- BackOffDelayFactor - this is the exponential factor by which the API Retry-After duration is increased on each attempt, e.g. 1.0 = no change, 1.5 = 50% increase, 2.0 = double. [Default = 1.0]
- HttpClientTimeoutSeconds - allows overriding the HTTP client timeout in seconds [default = 300]
- MaxAttemptCount - this is how many times we will attempt to re-try requests to Meraki (e.g. upon any type of failure). [Default = 5]
- MaxBackOffDelaySeconds - when Meraki sends HTTP status code 429 (too many requests), the back-off duration doubles on each attempt. This option sets the maximum back-off duration in seconds. [Default = 30]
- RateLimitMaxCalls - the maximum number of API calls to Meraki allowed in the specified time window (to use with RateLimitTimeSpanSeconds)
- RateLimitTimeSpanSeconds - the time window for the number of calls (to use with RateLimitMaxCalls)
- ReadOnly - when set to true, only HTTP GET requests can be sent to Meraki. [Default = false]. When using the Meraki Webhooks in AlertMagic, this should be set to false (or omitted)
To use rate-limiting, both the parameters (RateLimitMaxCalls and RateLimitTimeSpanSeconds) must be set, or rate-limiting will not be applied.
In Magic Suite 3.26, only the following are valid (the rest are valid from 3.27 onwards):
- ApiRegion
- RateLimitMaxCalls
- RateLimitTimeSpanSeconds
Configuration Examples
Example 1
This example uses the China region, and ensures that Meraki DataMagic makes no more than 100 calls within 60 seconds.
{
"ApiRegion": "China",
"RateLimitMaxCalls": 100,
"RateLimitTimeSpanSeconds" : 60
}
Example 2
This example customises various retry and back-off properties, and also allows HTTP requests that update items (such as creating Webhooks) by setting "ReadOnly" to false.
{
"ApiRegion": "Default",
"ApiNode" : "n72",
"BackOffDelayFactor": 1.5,
"HttpClientTimeoutSeconds": 600,
"MaxAttemptCount": 10,
"MaxBackOffDelaySeconds": 300,
"RateLimitMaxCalls": 5,
"RateLimitTimeSpanSeconds": 20,
"ReadOnly": false
}