<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to add multiple users by using API in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433734#M5450</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried to add some users as "Meraki Auth User" with this page; &lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.cisco.com/meraki/api-latest/#!create-network-meraki-auth-user" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-latest/#!create-network-meraki-auth-user&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I got 200, OK, when did via this site, by Meraki Python Library, and Python request template.&lt;/P&gt;&lt;P&gt;But I can't add some users at the SAME time.&lt;/P&gt;&lt;P&gt;Could you tell me some clues?&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;payload = '''{
    "accountType": "802.1X",
    "email": "xxx@test.com",
    "name": "Test Meraki",
    "password": "secretsecret",
    "emailPasswordToUser": false,
    "isAdmin": false,
    "authorizations": [
        {
            "ssidNumber": 0,
            "expiresAt": "Never"
        }
    ]
}'''&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 Mar 2023 09:53:09 GMT</pubDate>
    <dc:creator>mutsumi3232</dc:creator>
    <dc:date>2023-03-30T09:53:09Z</dc:date>
    <item>
      <title>How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433734#M5450</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried to add some users as "Meraki Auth User" with this page; &lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.cisco.com/meraki/api-latest/#!create-network-meraki-auth-user" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-latest/#!create-network-meraki-auth-user&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I got 200, OK, when did via this site, by Meraki Python Library, and Python request template.&lt;/P&gt;&lt;P&gt;But I can't add some users at the SAME time.&lt;/P&gt;&lt;P&gt;Could you tell me some clues?&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;payload = '''{
    "accountType": "802.1X",
    "email": "xxx@test.com",
    "name": "Test Meraki",
    "password": "secretsecret",
    "emailPasswordToUser": false,
    "isAdmin": false,
    "authorizations": [
        {
            "ssidNumber": 0,
            "expiresAt": "Never"
        }
    ]
}'''&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 09:53:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433734#M5450</guid>
      <dc:creator>mutsumi3232</dc:creator>
      <dc:date>2023-03-30T09:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433735#M5451</link>
      <description>&lt;P&gt;You can only add one user at a time. You would need to create multiple requests.&lt;/P&gt;&lt;P&gt;I haven't tried it with the user endpoint, but you could try &lt;A href="https://developer.cisco.com/meraki/api-latest/#!overview/action-batches" target="_self" rel="nofollow noopener noreferrer"&gt;action batches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 13:55:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433735#M5451</guid>
      <dc:creator>Greenberet</dc:creator>
      <dc:date>2023-03-30T13:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433736#M5452</link>
      <description>&lt;P&gt;Should just be able to accomplish it with a simple loop through a list for each call/user.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 15:14:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433736#M5452</guid>
      <dc:creator>Andy Mikulas</dc:creator>
      <dc:date>2023-03-30T15:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433737#M5453</link>
      <description>&lt;P&gt;Example of untested python script&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;from meraki import meraki
import json

# Set up the Meraki API key
MERAKI_API_KEY = 'your_api_key_here'
meraki_api = meraki.DashboardAPI(api_key=MERAKI_API_KEY)

# Set up the network ID for which you want to create Meraki Auth users
NETWORK_ID = 'your_network_id_here'

# Define the function to create Meraki Auth users
def create_meraki_auth_user(email, name, password):
    # Set up the payload for the Meraki API call to create the Meraki Auth user
    payload = {
        'email': email,
        'name': name,
        'password': password
    }

    # Make the Meraki API call to create the Meraki Auth user
    try:
        response = meraki_api.networks.createNetworkMerakiAuthUser(NETWORK_ID, payload)
        print(f"Created Meraki Auth user {email}")
    except meraki.APIError as e:
        print(f"Failed to create Meraki Auth user {email}: {e}")

# Read the user list file
with open('user_list.txt', 'r') as file:
    user_list = file.readlines()

# Loop through the user list and create Meraki Auth users
for user in user_list:
    email, name, password = user.strip().split(',')
    create_meraki_auth_user(email, name, password)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Mar 2023 15:25:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433737#M5453</guid>
      <dc:creator>Andy Mikulas</dc:creator>
      <dc:date>2023-03-30T15:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433738#M5454</link>
      <description>&lt;P&gt;I would give &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/66885"&gt;@Andy Mikulas&lt;/A&gt; even more kudos if I could for including a code concept snippit.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 19:34:44 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433738#M5454</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-03-30T19:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433739#M5455</link>
      <description>&lt;P&gt;Thank you &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/66885"&gt;@Andy Mikulas&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I tried this with a little arrangement for my environment, but I got an error below;&lt;/P&gt;&lt;P&gt;"Failed to create Meraki Auth user meraki.testmeraki2@test.com: networks, createNetworkMerakiAuthUser - 400 Bad Request, {'errors': ["'email' must be a string"]}"&lt;/P&gt;&lt;P&gt;Thank you again for your kind replies.&lt;/P&gt;&lt;P&gt;Warm Regards.&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;import meraki
import json

# Set up the Meraki API key
MERAKI_API_KEY = 'My_API_Key'
meraki_api = meraki.DashboardAPI(api_key=MERAKI_API_KEY)

# Set up the network ID for which you want to create Meraki Auth users
NETWORK_ID = 'My_Network_ID'
authorizations = [{'ssidNumber': 0, 'expiresAt': 'Never'}]

# Define the function to create Meraki Auth users
def create_meraki_auth_user(email, name, accountType, password):
    # Set up the payload for the Meraki API call to create the Meraki Auth user
    payload = {
        'email': 'xxxx@test.com',
        'name': 'test meraki1',
        'accountType': '802.1x',
        'password': 'passwordcisco'
    }

    # Make the Meraki API call to create the Meraki Auth user
    try:
        response = meraki_api.networks.createNetworkMerakiAuthUser(NETWORK_ID, [authorizations], payload)
        print(f"Created Meraki Auth user {email}")
    except meraki.APIError as e:
        print(f"Failed to create Meraki Auth user {email}: {e}")

# Read the user list file
with open('user_list.txt', 'r') as file:
    user_list = file.readlines()

# Loop through the user list and create Meraki Auth users
for user in user_list:
    email, name, accountType, password = user.strip().split(',')
    create_meraki_auth_user(email, name, accountType, password)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2023 06:31:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433739#M5455</guid>
      <dc:creator>mutsumi3232</dc:creator>
      <dc:date>2023-03-31T06:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433740#M5456</link>
      <description>&lt;P&gt;Thank you &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/33943"&gt;@Greenberet&lt;/A&gt; !!&lt;/P&gt;&lt;P&gt;I've just checked this solution, and am going to try this one.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 06:33:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433740#M5456</guid>
      <dc:creator>mutsumi3232</dc:creator>
      <dc:date>2023-03-31T06:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple users by using API</title>
      <link>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433741#M5457</link>
      <description>&lt;P&gt;Not sure, but sounds like the email you are passing is not being sent as a string,  Try double quotes around the email address perhaps?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;'email' : "&lt;A href="mailto:xxxx@test.com&amp;quot;" target="_blank" rel="nofollow noopener noreferrer"&gt;xxxx@test.com"&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That or the way you added in authorizations isn't passing correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code sample you posted doesn't appear to match what was used to generate the error.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 16:14:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/how-to-add-multiple-users-by-using-api/m-p/5433741#M5457</guid>
      <dc:creator>Andy Mikulas</dc:creator>
      <dc:date>2023-03-31T16:14:24Z</dc:date>
    </item>
  </channel>
</rss>

