- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Python meraki : Unable to claim network device
Hello,
I am trying to claim a network device by using the Python API.
I am using the library "meraki 0.100.2".
In this library, I am trying to use the method "claimNetworkDevices(self, networkId: str, **kwargs)", but it doesn't work.
Here is my code :
import meraki
if __name__ == "__main__":
dashboard = meraki.DashboardAPI()
serial = ['****-****-****']
network_id = "N_******************"
dashboard.devices.claimNetworkDevices(network_id,serial)
I get this error :
dashboard.devices.claimNetworkDevices(network_id,serial)
TypeError: claimNetworkDevices() takes 2 positional arguments but 3 were given
I have tried by using different type of serial argument :
serial = {
"serials": [
"****-****-****"
]
}
serial = "****-****-****'
serial = '****-****-****'
but I still have the same issue. I checked the method definition in "devices.py", but I didn't help.
It works fine when I use POSTMAN with the same request.
What am I doing wrong ? Does anyone have the same issue ?
Solved! Go to solution.
- Labels:
-
Code Sample
-
Dashboard API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you setting the api_key? I think the code you want looks something like this:
import meraki
api_key = "721e1notmyrealapikeyf72"
dashboard = meraki.DashboardAPI(api_key)
serialnums = ["XXXX-XXXX-XXXX"]
networkid = "L_6notmynetworkid93483"
claimdevice = dashboard.devices.claimNetworkDevices(networkid,serials=serialnums,)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you setting the api_key? I think the code you want looks something like this:
import meraki
api_key = "721e1notmyrealapikeyf72"
dashboard = meraki.DashboardAPI(api_key)
serialnums = ["XXXX-XXXX-XXXX"]
networkid = "L_6notmynetworkid93483"
claimdevice = dashboard.devices.claimNetworkDevices(networkid,serials=serialnums,)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Nick_B,
My api_key was already set in my environment variable.
I tried by using serials=serialnums, and it perfectly worked !
I tried again without specifying serials=, and it didn't work, so that was the thing I wasn't doing right
Thank you !
