cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2004
Views
9
Helpful
5
Replies

API to add network to a device.

orrellb
Frequent Visitor
Frequent Visitor

I'm working on some automation scripting and have figured out most of what I need except I can't figure out how to connect a network to a device. I have a script to get the details of an existing device and it shows a "networkId": "L_XXXXXXXXXXXXXX".

"networkID" is not listed in the schema on Update Device - Meraki Dashboard API v1 - Cisco Meraki Developer Hub so is this possible to do or is there another API call I should be using instead?

If I try to update a device with a PUT and using a "networkId": "L_YYYYYYYYYYYYY" I get

Status Code: 400
Response Text: {"errors":["Error for /devices/{serial}: None of the fields ('name', 'tags', 'lat', 'lng', 'address', 'notes', 'moveMapMarker', 'switchProfileId' or 'floorPlanId') were specified."]}

5 Replies 5

dajirku
Cisco Employee
Cisco Employee

You will have to remove it from the existing network https://developer.cisco.com/meraki/api-v1/remove-network-devices/ back into inventory and then assign it to the new network using https://developer.cisco.com/meraki/api-v1/claim-network-devices/

orrellb
Frequent Visitor
Frequent Visitor

The network and device I'm testing with are not part joined to any other device/network yet. In the example above I am able to see the 'networkId' if I look at an existing device that is already setup.

In the link you posted that shows 'networkId' as required but does not show that field in any of the examples or Schema Definition. That page looks the same as Claim Into Organization Inventory - Meraki Dashboard API v1 - Cisco Meraki Developer Hub to Claim a device into the inventory. I already have it in my inventory I just need to link it with a network.

orrellb
Frequent Visitor
Frequent Visitor

Oh I just spotted the 'networkId' as part of the API path. Let me test that.

bingo 😉 glad it worked! That construct of the API path being part of the context for the action is consistent in the API

orrellb
Frequent Visitor
Frequent Visitor

That worked. Thanks

The title 'Claim Network Devices' sounds way too similar to the other document of trying to claim it into the Inventory.