clientid - not working

Solved
Pmeza
Here to help

clientid - not working

Good Afternoon,

 

I've been trying for a long time to get endpoints with required 'clientid' path or query to work with absolutely no luck. I must be doing something horribly wrong!

 

I have a list of 'id' values in string format, separated by commas, in a list for client ids and network ids: (examples)

client_ids = ['13h23hu','3h283h823','32u3h2u3h']

network_ids = ['N_38382', 'L_38238273', 'N_3u2h3u2']

 

then I write a simple loop so it goes through each network id and client id to pull data:

for netid in network_id:
    for id in client_ids:
        test = dashboard.networks.getNetworkClient(netid, id)
        print(test)
 
then I get:
meraki.exceptions.APIError: networks, getNetworkClient - 404 Not Found, {'errors': ['Client not found']}
 
 
There is absolutely no way for there not to be a single result. I'm using the id that meraki assigns as 'id' in multiple endpoints for client_id. I'm assuming this is what they mean by 'clientid'. I've also tried MAC ids and IPs with the same setup, and inserting single values instead of a list - no luck.
 
At this point I'm at a loss so wondering if anyone else is having an issue specifically with endpoints that want a client id.
1 Accepted Solution
PhilipDAth
Kind of a big deal
Kind of a big deal

The loop you are using is looking for the list of clients in each of the networks defined, rather than a single network.

 

Does each of these clients actually exist in each of the three networks?  If they exist in only one of the networks, then you would expect to get 404 not found answers for the networks the client is not in.

View solution in original post

2 Replies 2
PhilipDAth
Kind of a big deal
Kind of a big deal

The loop you are using is looking for the list of clients in each of the networks defined, rather than a single network.

 

Does each of these clients actually exist in each of the three networks?  If they exist in only one of the networks, then you would expect to get 404 not found answers for the networks the client is not in.

Hi Phillip,

 

I adjusted my loop to:

 

for netid in network_id:
    for id in client_ids:
        try:
            test = dashboard.networks.getNetworkClient(netid, id)
            print(test)
        except meraki.exceptions.APIError as e:
            if '404 Not Found' in str(e😞
                print(f"Client ID {id} not found in network ID {netid}")
            else:
                # Handle other API errors
                print(f"Error occurred for client ID {id} in network ID {netid}: {e}")
 
now I get to see where the error is. I removed the networkid that didn't have any clients in and now the endpoint is working.
 
Thanks for the quick reply!
Get notified when there are additional replies to this discussion.