This learning lab demonstrates the power of Meraki APIs with Google Scripts and Forms.
By building a simple Google Form and attaching a script written in JavaScript, a Meraki Dashboard administrator can easily be created. This is incredibly helpful when running workshops that require several administrators to have access to a lab network.
- Name
[SAMPLE]
- code.gs
- update the API_KEY, ORG_ID and SHARD to match your settings.
- save your changes
- Run: onFormSubmit
- Events: From form
- --> On form submit
Several additional functions are included in this code to allow you to test with sample data and collect information.
- Run --> Select a test function
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 --> Logs
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.
- Meraki Dashboard --> Organization --> Administrators
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!