cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1936
Views
4
Helpful
3
Replies

load many 802.1x users

RubenRios27749
Visitor

hello.

I have a question and your help.

I need to upload at least 900 Meraki WPA2-Enterprise 802.1X with Meraki RADIUS users , I see that with the APIs it is possible, but only one by one, as if doing it by dashboard. can you give me a light on how to do a bulk upload from excel with the help of the APIs - Python, etc.
Thank you very much for your answers

1 Accepted Solution

Accepted Solutions

Hello Phillip.

With the help of a colleague who knew python we made this code and it worked perfectly. just download the .csv in this path All the network>All the network>All the network and with that file we load the users info.

import requests
import pandas as pd
import json

excel_file_path = 'meraki_network_guests.xlsx' #Ruta donde se encuentra el archivo excel#
url = "https://api.meraki.com/api/v1/networks/IDNEtwork/merakiAuthUsers"


df = pd.read_excel(excel_file_path)


payload = '''
{
"accountType": "802.1X",
"email": "",
"name": "",
"password": "",
"emailPasswordToUser": true,
"isAdmin": false,
"authorizations": [
{
"ssidNumber": number of ssid,
"expiresAt": "Never"
}
]
}
'''
for index, row in df.iterrows():
data = json.loads(payload)

data["email"] = row['email']
data["name"] = row['name']
data["password"] = row['password']

headers = {
"Authorization": "Bearer HERE KEY",
"Content-Type": "application/json",
"Accept": "application/json"
}

response = requests.request('POST', url, headers=headers, data = json.dumps(data))

print(response.text.encode('utf8'))

View solution in original post

3 Replies 3

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

Use a loop. Loop through all the users you want to load, and load them one at a time.

Hello Phillip.

With the help of a colleague who knew python we made this code and it worked perfectly. just download the .csv in this path All the network>All the network>All the network and with that file we load the users info.

import requests
import pandas as pd
import json

excel_file_path = 'meraki_network_guests.xlsx' #Ruta donde se encuentra el archivo excel#
url = "https://api.meraki.com/api/v1/networks/IDNEtwork/merakiAuthUsers"


df = pd.read_excel(excel_file_path)


payload = '''
{
"accountType": "802.1X",
"email": "",
"name": "",
"password": "",
"emailPasswordToUser": true,
"isAdmin": false,
"authorizations": [
{
"ssidNumber": number of ssid,
"expiresAt": "Never"
}
]
}
'''
for index, row in df.iterrows():
data = json.loads(payload)

data["email"] = row['email']
data["name"] = row['name']
data["password"] = row['password']

headers = {
"Authorization": "Bearer HERE KEY",
"Content-Type": "application/json",
"Accept": "application/json"
}

response = requests.request('POST', url, headers=headers, data = json.dumps(data))

print(response.text.encode('utf8'))

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

Well done!