API scripting - Bulk creation and serial numbers

Solved
dan_cullen
Conversationalist

API scripting - Bulk creation and serial numbers

I was wondering if anyone could help. I am trying to write Python scripts. One of the scripts I am writing is to create networks. I can't seem to find any Meraki API code that would allow me to create networks and assign serial numbers to the newly created network (Meraki MX for SD-WAN). You can if you manually use Bulk network creator but this may be closed of by Meraki when it comes to scripting. Any help would be great.

 

 

1 Accepted Solution
David_Jirku
Meraki Employee
Meraki Employee

A device (serial number) can only exist in one org. If you attempt to claim a device serial into the network which you don't have in the org inventory, you'll receive an error:

 

{ "errors": [ "Device with serial Q234-ABCD-0001 not found" ] }

 

If you attempt to claim a serial already in the network:

 

{ "errors": [ "Device with serial QXXV-FXXR-XXD7 is already claimed and in Test Network (network ID: L_9906373669455549372)" ] }

 

Otherwise, success is just a 200, OK; success.

 

The Meraki Dashboard will not allow you (or your API key) access to inventory that you don't have privileges for.

View solution in original post

7 Replies 7
alemabrahao
Kind of a big deal
Kind of a big deal

Have you checked it?

 

https://github.com/meraki/automation-scripts

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
dan_cullen
Conversationalist

Thanks for the reply, but unfortunately it does not appear to have a create network, or update device with serial number. I can create networks with everything apart from the assigning serials of Meraki MX's to the network.

David_Jirku
Meraki Employee
Meraki Employee

You can claim a device from inventory into a network using the following endpoint:

 

https://developer.cisco.com/meraki/api-v1/claim-network-devices/

 

If they are not yet in inventory, you can use: 

 

https://developer.cisco.com/meraki/api-v1/claim-into-organization-inventory/

dan_cullen
Conversationalist

Thanks David, I have seen that but here is my worry, and please correct me if I am wrong. When you run this code it simply asks for a NetworkID. Which is fine, but I have 3 organizations. How does it know which organization it is for and does this just pull from the Meraki database not the inventory ? Just worries me a little

David_Jirku
Meraki Employee
Meraki Employee

A device (serial number) can only exist in one org. If you attempt to claim a device serial into the network which you don't have in the org inventory, you'll receive an error:

 

{ "errors": [ "Device with serial Q234-ABCD-0001 not found" ] }

 

If you attempt to claim a serial already in the network:

 

{ "errors": [ "Device with serial QXXV-FXXR-XXD7 is already claimed and in Test Network (network ID: L_9906373669455549372)" ] }

 

Otherwise, success is just a 200, OK; success.

 

The Meraki Dashboard will not allow you (or your API key) access to inventory that you don't have privileges for.

John_on_API
Meraki Employee
Meraki Employee

Network IDs are globally unique, so org ID isn't needed.

dan_cullen
Conversationalist

Funny story for you both, I was pulling and playing with the data and saw a network that was supposed to be in another organization pull through. I thought, Network_ID's must not be unique, only unique to the organization. Turns out, my work colleague was replicating the company in our lab so I was pulling through the correct one but it looked like the other. Thanks John and David for the advice. I am going to try all of the above today, much appreciated.  

Get notified when there are additional replies to this discussion.