title: CakePHP 2.x - Accessing $_POST data within controller (REST POST request)
body: <p>I'm creating an API using Cakephp 2.x that needs a POST request to post some data to the server however when I'm posting (using Postman) to <code>127.0.0.1/appname/api/confirm</code> with <code>code=123</code> in the post parameters my <code>$_POST</code> is an empty array. </p>
  
  <p>My route works, I can see variables that I declare and output within the controller, and I've checked that the parameters are being passed in the request by using the chrome developer console checking the network data.</p>
  
  <pre><code>Router::connect('/api/confirm', array('controller' =&gt; 'awesomeController', 'action' =&gt; 'confirm'));
  
  &lt;?php        
  class AwesomeController extends AppController {
       public function confirm() {
           $this-&gt;autoRender = false;
           $this-&gt;layout = 'ajax';
           pr($_POST);     
       }
  } 
  ?&gt;
  </code></pre>
  
  <p>I've got my endpoints for the get requests to work just fine, it only seems to be POST data.</p>
  
  <p>Not quite sure why <code>$_POST</code> wouldn't even be available and I'm sure it's something ridiculously silly I've overlooked!</p>
  
  <p>** Edit **</p>
  
  <p>I've attempted the following without success:</p>
  
  <pre><code>$this-&gt;request-&gt;query
  $this-&gt;request-&gt;data
  $this-&gt;request-&gt;params
  </code></pre>
  
  <p>I have another method whereby I use GET along with ?parameter=value etc and I am able to use one of the above calls to retrieve the data.</p>