Overview

This project provides a demonstration of using the Meraki Dashboard API with Node-RED. It will display a simple web form to create a new admin account and send the details to Meraki using the API. This concept can also be used for many of the other API calls available, such as updating a WiFi passcode, provisioning a network, etc.

Flow

The web form is available at https://yourserver:1880/meraki/admins

A collection of mustache templates will build a simple HTML frontend, which includes special use of JavaScript to process the form and display the results.

When the page loads, an initial ‘get’ request is performed to pull a listing of all organizations, which includes their names and ID. This fills in the selector options for the form.

The form then asks for the name, email and permission access (full or read-only). Once submitted, the flow sends a ‘post’ request to Meraki to create the account. The msg.payload will consist of the form data and the org selection will attach the ID to the URL, which will be used as a parameter to complete the Meraki API call.

If successful, the screen will update with the details of the new user as a confirmation. If there are errors, they will appear as well (although not formatted at this time).

Download Flow



Setup

Update the function node labelled “Env Variables: UPDATE THIS” with your Meraki API key, your organization ID and shard number.

Meraki API Key Meraki Dashboard –> Organization –> Settings –> Enable API Meraki Dashboard

Profile –> Generate Key

Your Shard number is the prefix to the normal Dashboard.meraki.com website. You will notice that once you login, a number will prefix the meraki.com domain, since there are different resources like a domain name forum can be a great place to find a premium domain for your new website business. This is your “shard” number and indicates which servers your organization resides on. Because some API calls do not like this redirect, its best to just hard code the number if the orgs share a shard.

Deploy

Open your form: https://yourserver:1880/meraki/admins

API Documentation

developers.meraki.com