Re: CakePHP REST service does not recognize POST

2012-07-30 Thread Zaky Katalan-Ezra
pr($this->RequestHandler)
just above
if( $this->RequestHandler->isPost() ) {

What is the output?

By the way, I use this to check post
$this->request->is('post')

On Thu, Jul 26, 2012 at 11:29 PM, frederikjacques wrote:

> $this->RequestHandler




-- 
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP REST service does not recognize POST

2012-07-29 Thread Dr. Tarique Sani
Create a form and post it to the URL and work forwards from there. -
could be something wrong with the extension.

The ->isPost() method is very simple and just uses
$_SERVER['REQUEST_METHOD'] to check the method

HTH
Tarique



On Fri, Jul 27, 2012 at 1:59 AM, frederikjacques  wrote:
> Hi all,
>
> I'm trying to get my REST services up and running, the routing works, but
> when i do a POST to my service, the RequestHandler->isPost() function
> returns false.
> Could somebody help me out what I'm doing wrong???
>
>> Routes.php
>>
>> Router::connect(
>>
>> '/authenticate',
>>
>> array(
>>
>> 'controller' => 'users',
>>
>> 'action' => 'login',
>>
>> '[method]' => 'POST')
>>
>> );
>>
>>
>> Router::parseExtensions('json');
>
>
>>  Login function in UsersController.php (for demo purpose i just return if
>> it detects a post or not)
>>
>>  if( $this->RequestHandler->isPost() ) {
>> $this->set('loginResult', 'post');
>> $this->set('_serialize', array('loginResult'));
>>  }else{
>> $this->set('loginResult', 'no post');
>> $this->set('_serialize', array('loginResult'));
>>  }
>
>
> Now I use REST Console extension in Chrome to do a call to my REST service
> (http://path_to_localhost_website/authenticate)
> This is the result returned:
>
> Request Headers
>
> Accept: application/json
> Content-Type: application/json
> Connection: keep-alive
> Origin: chrome-extension: //rest-console-id
> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0)
> AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
>
>
> Request Body
>
> Request Url: http://localhost/ris/winsol/winsol_admin/authenticate
> Request Method: POST
> Status Code: 200
> Params: {
> "email": "frede...@the-nerd.be",
> "password": "fd12d90f5670211f5bd4f2816baa7299eb256e1f"
> }
>
>
> Response Headers
>
> Status Code: 200
> Date: Thu, 26 Jul 2012 20:25:41 GMT
> X-Powered-By: PHP/5.3.6
> Connection: Keep-Alive
> Content-Length: 25
> Server: Apache
> Content-Type: application/json
> Keep-Alive: timeout=5, max=99
>
>
> Response Body:
> { "loginResult": "no post" }
>
> I hope somebody can help me out, because it is driving me mad :-)
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php



-- 
=
PHP for E-Biz: http://sanisoft.com
=

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


CakePHP REST service does not recognize POST

2012-07-27 Thread frederikjacques
Hi all,

I'm trying to get my REST services up and running, the routing works, but 
when i do a POST to my service, the RequestHandler->isPost() function 
returns false.
Could somebody help me out what I'm doing wrong???

*Routes.php*

Router::connect(

'/authenticate',

array(

'controller' => 'users',

'action' => 'login',

'[method]' => 'POST')

);


> Router::parseExtensions('json');


* Login function in UsersController.php (for demo purpose i just return if 
> it detects a post or not)*

 if( $this->RequestHandler->isPost() ) {
> $this->set('loginResult', 'post');
> $this->set('_serialize', array('loginResult'));
>  }else{
> $this->set('loginResult', 'no post');
> $this->set('_serialize', array('loginResult'));
>  }


Now I use* REST Console* extension in Chrome to do a call to my REST 
service (http://path_to_localhost_website/authenticate)
This is the result returned:

*Request Headers*

   1. Accept: application/json
   2. Content-Type: application/json
   3. Connection: keep-alive
   4. Origin: chrome-extension: //rest-console-id
   5. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit
   /536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11


*Request Body*

   1. Request Url: http://localhost/ris/winsol/winsol_admin/authenticate
   2. Request Method: POST
   3. Status Code: 200
   4. Params: {
   5. "email": "frede...@the-nerd.be",
   6. "password": "fd12d90f5670211f5bd4f2816baa7299eb256e1f"
   7. }


*Response Headers*

   1. Status Code: 200
   2. Date: Thu, 26 Jul 2012 20:25:41 GMT
   3. X-Powered-By: PHP/5.3.6
   4. Connection: Keep-Alive
   5. Content-Length: 25
   6. Server: Apache
   7. Content-Type: application/json
   8. Keep-Alive: timeout=5, max=99


*Response Body:*
{ "loginResult": "no post" }

I hope somebody can help me out, because it is driving me mad :-)  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php