Build a simple Google Form to provision and configure a Meraki network with a single click. This saves time by avoiding the need to build a front end website. You can also easily tie into the many Google Apps services to extend the business workflow. The form works by attaching a script written in JavaScript to make API calls to the Meraki Dashboard API.

Launch Demo

Tutorial

This learning lab demonstrates the power of Meraki APIs with Google Scripts and Forms.

Scenario

A workshop requires students to register their details as well as grant network access to the Meraki sandbox network.

Goal

Build a Google Form to collect user details

Trigger a script to create a new Meraki Administrator for the sandbox network

Prerequisites

  • Meraki Dashboard
  • Dashboard API Key
  • Google Account

Instructions

Follow this guide to build your form and connect the Meraki Dashboard API. All of the source code and other examples can be found in the project GitHub repository.

Source Code

Google Form

Begin by creating a Google Form

Google Forms

The first two questions should be as follows

  • Email (set to required)
  • Name

SAMPLE

Form

Add a Script

Link the form to a Google Script by selecting the Script editor from the top right menu.

Google Scripts Menu

Paste the contents of this repository’s example-register/MerakiAdmin-form.gs file into the Google Scripts IDE.

MerakiAdmin-form.gs

Set Environment Variables

Update the API_KEY, ORG_ID and SHARD to match your settings.

Save your changes.

Google Scripts IDE

Add a Trigger to launch the script when the Form is submitted.

Triggers Menu

Configure the trigger

  • Run: onFormSubmit
  • Events: From form
  • –> On form submit

Triggers

Test the API calls

Several additional functions are included in this code to allow you to test with sample data and collect information.

  • Run –> Select: testGetMerakiOrgs

Run Menu

Feel free to modify the sample JSON data defined in the testAddMerakiAdmin function.

function testAddMerakiAdmin(){
 var data = {
 "name":"Google Scripts Demo",
 "email":"[email protected]", // change this to an email you have access to!
 "orgAccess":"full"
 };
 addMerakiAdmin(API_KEY,ORG_ID,SHARD,data);
 }
                

View the results

  • View –> Logs

Logs Menu

Logs

Google Form

Now that the API calls are working, test the Google Form by hitting the preview button.

Logs

Complete the form with a valid email address.

Logs

If everything worked, you should get an email from Meraki asking to complete the admin account verification.

Note: If you used an email that already has access to a Meraki Dashboard, then log into that account to accept an authorization message by Meraki.

Logs Menu

Verify Meraki account is created

  • Meraki Dashboard –> Organization –> Administrators

Admin Users

SUCCESS!

You have now used the Meraki APIs to dynamically create Meraki administrator accounts. With Google Apps, you do not even need to host a server to run the application. Cool!