0

I would like to call a rest function of my api with the GET protocol but I didn't succeed to put the security key of restler as a post parameter.

example:

/index.php/myrestapi/method.json?name=test post field : Array('key'=>'mykey')

$session = curl_init('<mydomainurl>/index.php/myrestapi/method.json?name=test');

// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, array('key'=>'mykey');

// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($session);

Myrestapi.php function:

protected function getMethod($name){
    return $name;
}

What is wrong?!

Thanks in advance for your help!

Kevin

kevins
  • 46
  • 5

1 Answers1

0

security key should also be part of get parameter

<mydomainurl>/index.php/myrestapi/method.json?name=test&key=mykey

Then need to handle that with iAuthenticate.

For more details see e.g. Protected API of restler.