- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
get_network_clients giving 'HTTP response not OK' error
I'm pretty new to using Python, and I'm having issues getting this to work. I set the collect dict like this
collect['network_id'] = netids['deepellum']
collect['t_0'] = 't0'
collect['timespan'] = 900
collect['per_page'] = 500
collect['starting_after'] = 'startingAfter'
collect['ending_before'] = 'endingBefore'
and then I have this
result = clients_controller.get_network_clients(collect)
As you can see, I pretty much just copied from the meraki sdk documentation.
If I take all the optional params out and just leave the network ID inside collect it runs with no errors. I'm sure there must be something simple I am missing, I'm just new to Python and API's in general. Any help would be much appreciated.
Solved! Go to solution.
- Labels:
-
Dashboard API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
with regards to the Meraki API - have you installed PostMan?
I'm pretty new to the meraki api and have be messing with powershell rather than python and found that Postman with the Meraki Dashboard API collection installed helps you to run various api calls without the need for all the convoluted script code around it.
once you've sorted out the parameters etc for the particular API call, you can then wrap the necessary code around it etc.
With regards to your code - if you run the api call in Postman, it fails with the values you have below with a bad request error or 404 error.
The t0 parameter needs to be a valid time value - if you remove it as a parameter, like so and do this in Postman it returns a list of clients
try the your code in python again, but remove the t0 line and just have either startingafter = "" or endingBefore = "" (aparently can't have both according to error returned by Postman if both included in the API call
e.g. - this fails:
let me know how you get on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
with regards to the Meraki API - have you installed PostMan?
I'm pretty new to the meraki api and have be messing with powershell rather than python and found that Postman with the Meraki Dashboard API collection installed helps you to run various api calls without the need for all the convoluted script code around it.
once you've sorted out the parameters etc for the particular API call, you can then wrap the necessary code around it etc.
With regards to your code - if you run the api call in Postman, it fails with the values you have below with a bad request error or 404 error.
The t0 parameter needs to be a valid time value - if you remove it as a parameter, like so and do this in Postman it returns a list of clients
try the your code in python again, but remove the t0 line and just have either startingafter = "" or endingBefore = "" (aparently can't have both according to error returned by Postman if both included in the API call
e.g. - this fails:
let me know how you get on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, that worked perfectly. Thanks so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
great stuff RobJ - good to hear 🙂
Not sure why my post appears twice though - anyone help on how to post properly in a forum - lol 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found this helpful? Give me some Kudos! (click on the little up-arrow below) New to the community? Get started here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
aha!, thanks MeredithW - thought it was old age creeping in 😄
