cancel
Showing results for 
Search instead for 
Did you mean: 

You are being redirected

SOLVED
Highlighted
Conversationalist

You are being redirected

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;
}

1 ACCEPTED SOLUTION

Accepted Solutions
Kind of a big deal

Re: You are being redirected

If you can't followed the redirect then you need to make an initial request to get the URL for your main request.
2 REPLIES
Kind of a big deal

Re: You are being redirected

If you can't followed the redirect then you need to make an initial request to get the URL for your main request.
Meraki Employee

Re: You are being redirected

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)