06-04-2018 01:31 AM
Probably a stupid question :-D.
I want to get all the clients on the network. My script is working but I get the sentence "You are being redirected" instead of an array with the data. If I click on the link behind "Redirected" I get all the data. But I need this info for my script. Any help would be great.
My code:
<?php
$request = new HttpRequest();
$request->setUrl('https://api.meraki.com/api/v0/devices/SERIALNUMBER/clients');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'timespan' => '84000'
));
$request->setHeaders(array(
'postman-token' => '7187e3f4-f792-c5f6-da1e-73e51253767d',
'cache-control' => 'no-cache',
'x-cisco-meraki-api-key' => 'api key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Solved! Go to Solution.
06-04-2018 03:13 AM
06-04-2018 03:13 AM
06-05-2018 07:15 AM
Yes, the redirects will cause issues.
For example, I've included scripts in my JS code to handle it.
https://github.com/dexterlabora/meraki-splash-gp/blob/master/request-meraki.js
meraki-service (in development)
https://dexterlabora.github.io/meraki-service/
(sorry no PHP example)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide