<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" 
  xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  xmlns:dc="http://purl.org/dc/elements/1.1/" 
  xmlns:atom="http://www.w3.org/2005/Atom" 
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
  xmlns:media="http://search.yahoo.com/mrss/">
  <channel>
    <title>meraki on Ben&#39;s ideas and projects</title>
    <link>https://ben.the-collective.net/tags/meraki/</link>
    <description>Recent content in meraki on Ben&#39;s ideas and projects</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>locutus@the-collective.net (Ben Mason)</managingEditor>
    <webMaster>locutus@the-collective.net (Ben Mason)</webMaster>
    <copyright>©2023, All Rights Reserved</copyright>
    <lastBuildDate>Wed, 19 Jun 2019 19:18:14 -0400</lastBuildDate>
    <sy:updatePeriod>daily</sy:updatePeriod>
    
        <atom:link href="https://ben.the-collective.net/tags/meraki/index.xml" rel="self" type="application/rss+xml" />
    

      
      <item>
        <title>How to set up a Meraki API Test environment</title>
        <link>https://ben.the-collective.net/posts/2019-06-19-how-to-set-up-a-meraki-api-test-environment/</link>
        <pubDate>Wed, 19 Jun 2019 19:18:14 -0400</pubDate>
        <author>locutus@the-collective.net (Ben Mason)</author>
        <atom:modified>Wed, 19 Jun 2019 19:18:14 -0400</atom:modified>
        <guid>https://ben.the-collective.net/posts/2019-06-19-how-to-set-up-a-meraki-api-test-environment/</guid>
        <description>I needed to set up and Meraki API key to test, well an Meraki API that was in beta. This is the process I used to get started with some of the basics of the Meraki API and getting a test environment up and running. There are lots of great references covering the basics of REST APIs like the REST API Tutorial. These resources will do a much better job then I can of explaining REST APIs.</description>
        <content:encoded>&lt;p&gt;I needed to set up and Meraki API key to test, well an Meraki API that was in beta. This is the process I used to get started with some of the basics of the Meraki API and getting a test environment up and running. There are lots of great references covering the basics of REST APIs like the &lt;a href=&#34;https://restapitutorial.com/&#34;&gt;REST API Tutorial&lt;/a&gt;. These resources will do a much better job then I can of explaining REST APIs. I found there was a lack of guide for the initial steps of building the data you need to get started with the Meraki API.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: The screenshots are from late 2018 and may have changed over time.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;api-key-generation&#34;&gt;API Key Generation&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-20.23.28.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
First things first you will need to login to the Meraki Dashboard. Once there, you will navigate using the menu on the left to Organization -&amp;gt; Settings.&lt;/p&gt;
&lt;p&gt;On the settings screen scroll down to Dashboard API Access, and check “Enable access to the Meraki Dashboard API” and click Save at the bottom. Once the general access is enabled you will need to click the “profile” link to go to the screen where you generate an API Key to use than making REST API calls.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-20.23.21.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
On the API access click the “Generate new API Key” button. If the button is not there I found with my account I can only have a maximum of two API keys generated at any point in time. Once I deleted one key the button came back.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-20.23.57.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
After clicking the button a dialogue similar to this showing you your new key, this key is only shown once so make a note of it since you will use it to authenticate your API calls.&lt;/p&gt;
&lt;h2 id=&#34;now-that-you-have-a-key-what-to-do-with-it&#34;&gt;Now that you have a key what to do with it?&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-21.22.48.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
Meraki has an extensive API with many calls and you will want a tool to start to test some of the calls. A good utility to start testing with is &lt;a href=&#34;https://www.getpostman.com/&#34;&gt;Postman&lt;/a&gt;. This tool allows you to make REST API calls using a convenient GUI. I won’t go into complete detail on how to use Postman but cover some highlights to getting it &lt;g class=&#34;gr_ gr_6 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del&#34; data-gr-id=&#34;6&#34; id=&#34;6&#34;&gt;setup&lt;/g&gt; to test some Meraki API calls.&lt;/p&gt;
&lt;p&gt;A useful feature of Postman is the ability to import collections of API calls. The collection of Meraki Dashboard calls is at &lt;a href=&#34;https://create.meraki.io/postman&#34;&gt;https://create.meraki.io/postman&lt;/a&gt;. Once there click “Run in Postman” in the upper right and it will ask to open the Postman client. Once you import the collection there will need to be some variables you will need to discover and fill in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;X-Cisco-Meraki-API-Key&lt;/li&gt;
&lt;li&gt;organizationId&lt;/li&gt;
&lt;li&gt;networkId&lt;/li&gt;
&lt;li&gt;baseUrl&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To set these variables you will need to edit the newly imported Postman collection, you can right click on the collection and select “Edit.”&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-21.26.21.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
Then select the Variables tab, I have populated these vari&lt;g class=&#34;gr_ gr_3 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace&#34; data-gr-id=&#34;3&#34; id=&#34;3&#34;&gt;a&lt;/g&gt;bles already in the screenshot, you will need to type them in.&lt;/p&gt;
&lt;figure class=&#34;wp-block-image is-resized&#34;&gt;![](../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-21.27.59.png)
Now you ask where do I find the values for these variables. I’ll cover the calls that are made to collect the values you need in the next few sections.
&lt;h2 id=&#34;meraki-api-url-baseurl-and-api-key&#34;&gt;Meraki API URL (baseUrl) and API Key&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;baseURL&lt;/strong&gt;&lt;br /&gt;
The first variable you will set it the &lt;em&gt;baseUrl&lt;/em&gt; this is the URL that Postman will use to send REST API calls to. In general for testing you can the use URL:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;pre class=&amp;#34;wp-block-preformatted&amp;#34;&amp;gt;https://dashboard.meraki.com/api/v0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will work for testing and non-production. Once you go to production you will want to point to the specific shard you are hosted on such as:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;pre class=&amp;#34;wp-block-preformatted&amp;#34;&amp;gt;https://n466.meraki.com/api/v0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;X-Cisco-Meraki-API-Key&lt;/strong&gt;&lt;br /&gt;
We will also need to set the API key which we generated earlier. This is stored in the &lt;em&gt;X-Cisco-Meraki-API-Key&lt;/em&gt; variable. This variable sets the header also named &lt;em&gt;X-Cisco-Meraki-API-Key&lt;/em&gt; in REST calls. This is used to authenticate the REST calls.&lt;/p&gt;
&lt;p&gt;With these two variables set you can start to discover the organizationId and networkIds.&lt;/p&gt;
&lt;h3 id=&#34;finding-the-organizationid&#34;&gt;Finding the “organizationId”&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-22.04.07.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
To find the organizationId, in Postman navigate to “Organizations -&amp;gt; List organizations this user has access to” in the sidebar on the left.&lt;/p&gt;
&lt;p&gt;The query in Postman looks like:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-22.04.30.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
The full REST URL to retrieve the Meraki Organizations you have access to is: &lt;a href=&#34;https://dashboard.meraki.com/api/v0/organizations&#34;&gt;https://dashboard.meraki.com/api/v0/organizations&lt;/a&gt;&lt;br /&gt;
The data returned shows the organizations you have access to. The “id” number is the field used to select the organization you wish to query&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;pre class=&amp;#34;wp-block-preformatted&amp;#34;&amp;gt;[ { &amp;#34;id&amp;#34;: 1234567, &amp;#34;name&amp;#34;: &amp;#34;Organization name&amp;#34; } 
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;finding-the-networkids&#34;&gt;Finding the “networkIds”&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-22.08.10.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
Many calls I have worked will use either &lt;g class=&#34;gr_ gr_137 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace&#34; data-gr-id=&#34;137&#34; id=&#34;137&#34;&gt;the &lt;/g&gt;&lt;code&gt;organizationID&lt;/code&gt;&lt;g class=&#34;gr_ gr_137 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Style multiReplace&#34; data-gr-id=&#34;137&#34; id=&#34;137&#34;&gt; or&lt;/g&gt;&lt;g class=&#34;gr_ gr_158 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace&#34; data-gr-id=&#34;158&#34; id=&#34;158&#34;&gt;a &lt;/g&gt;&lt;code&gt;networkId&lt;/code&gt;&lt;g class=&#34;gr_ gr_158 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Style multiReplace&#34; data-gr-id=&#34;158&#34; id=&#34;158&#34;&gt;.&lt;/g&gt; In most organizations, there are multiple networks in the organization you are querying. Each of the networks is identified by the &lt;code&gt;networkId&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The full REST URL to retrieve the Meraki Networks in an Organization you have access to is: &lt;a href=&#34;https://dashboard.meraki.com/api/v0/organizations/1234567/networks&#34;&gt;https://dashboard.meraki.com/api/v0/organizations/1234567/networks&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../2019-06-19-how-to-set-up-a-meraki-api-test-environment-images/Screen-Shot-2018-10-29-at-22.04.30.png&#34; alt=&#34;&#34; /&gt;&lt;br /&gt;
The output below will list all of the networks in the Organization, the field labeled “id” is what you will use to query data for a specific network.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;pre class=&amp;#34;wp-block-preformatted&amp;#34;&amp;gt;[ &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;{ &amp;#34;id&amp;#34;: &amp;#34;L_234567890&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;organizationId&amp;#34;: &amp;#34;1234567&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;name&amp;#34;: &amp;#34;Test Network&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;timeZone&amp;#34;: &amp;#34;US/Eastern&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;tags&amp;#34;: null, &amp;#34;type&amp;#34;: &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;combined&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;disableMyMerakiCom&amp;#34;: false }, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;{ &amp;#34;id&amp;#34;: &amp;#34;N_678901234&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;  &amp;#34;organizationId&amp;#34;: &amp;#34;1234567&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt; &amp;#34;name&amp;#34;: &amp;#34;Systems Manager&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt; &amp;#34;timeZone&amp;#34;: &amp;#34;America/Detroit&amp;#34;, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt; &amp;#34;tags&amp;#34;: null, &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt; &amp;#34;type&amp;#34;: &amp;#34;systems manager&amp;#34; } &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;] 
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;done&#34;&gt;Done?&lt;/h2&gt;
&lt;p&gt;Now there is a test environment to play and learn how the various API calls work and what data can be collected, set, or deleted. Postman is just the start for experimentation and to&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://create.meraki.io/&#34;&gt;https://create.meraki.io/&lt;/a&gt;&lt;/p&gt;
</content:encoded>
        <dc:creator>suidroot</dc:creator>
        <media:content url="https://ben.the-collective.net/images/post-images/How-to-set-up-a-Meraki-API-Test-environment.png" medium="image"><media:title type="html">featured image</media:title></media:content>
        
        
        
          
            
              <category>api</category>
            
          
            
              <category>meraki</category>
            
          
            
              <category>networking</category>
            
          
            
              <category>programing</category>
            
          
        
        
          
            
              <category>Networking</category>
            
          
        
        
      </item>
      

    
  </channel>
</rss>
