title: CakePHP - sending POST requests in cakephp API and data handling
body: <p>I have created a CakePHP app and after already set the routes.php files,i can send JSON requests,in order to use my app as an API. For testing,i have created a function which goes like this:</p>
  
  <pre><code>public function api() {
      if($this-&gt;request-&gt;is('post')) {
          $data1 = (string)$this-&gt;request-&gt;data['Model']['data1'];
          $data2 = (string)$this-&gt;request-&gt;data['Model']['data2'];
  
          //logic goes here,it does stuff and $result is the variable where the result of the login is saved
          //$data1 and $data2 are used in the logic
  
          $result = 'result';
          $this-&gt;set('results',$result);
          $this-&gt;set('_serialize',array('results'));
      }
  
  }
  </code></pre>
  
  <p>I have also created the exact same function with another name,which is meant to be used via a web form and that works correctly. BUT,this code,at this function here,when i POST data (i use Dev HTTP Client chrome extension),it returns the $results variable empty,like it does not receive what i send :/
  I send the data as follows via the chrome extension i use:</p>
  
  <pre><code>data1='stuff1'&amp;data2='stuff2'
  </code></pre>
  
  <p>and it returns me just</p>
  
  <pre><code>{
  "results":""
  }
  </code></pre>
  
  <p>(while the same code works perfectly when used without json).</p>
  
  <p>Did i miss something?Does it seem to do something wrong? Please help me a bit around here..</p>
  
  <p>ps:if you need more info,just tell me and i'll post it.</p>
  
  <p>Thank you in advance!</p>