Provision Networks with a Google Form
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.
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.
Google Form
Begin by creating a Google Form
The first two questions should be as follows
- Email (set to required)
- Name
SAMPLE
Add a Script
Link the form to a Google Script by selecting the Script editor from the top right menu.
Paste the contents of this repository’s example-register/MerakiAdmin-form.gs file into the Google Scripts IDE.
Set Environment Variables
Update the API_KEY, ORG_ID and SHARD to match your settings.
Save your changes.
Add a Trigger to launch the script when the Form is submitted.
Configure the trigger
- Run: onFormSubmit
- Events: From form
- –> On form submit
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
Feel free to modify the sample JSON data defined in the testAddMerakiAdmin function.
function testAddMerakiAdmin(){
var data = {
"name":"Google Scripts Demo",
"email":"GoogleScriptsDemo@meraki.com", // change this to an email you have access to!
"orgAccess":"full"
};
addMerakiAdmin(API_KEY,ORG_ID,SHARD,data);
}
View the results
- View –> Logs
Google Form
Now that the API calls are working, test the Google Form by hitting the preview button.
Complete the form with a valid email address.
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.
Verify Meraki account is created
- Meraki Dashboard –> Organization –> Administrators
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!