title: Cannot get body from DELETE request with Slim Framework
body: <p>I'm working in an app using backbone.js and Slim Framework.
  The issue is here: I need to delete a record by executing a MySQL stored procedure that receives, besides the ID of the record to delete, another parameter to execute some business logic.
  The problem is that I only receive the ID of the record. My $app->request()->getBody(); is blank.
  Here is the code:</p>
  
  <p>/rest/folder/index.php</p>
  
  <pre><code>&lt;?php
  require_once '../../vendors/Slim/Slim.php';
  \Slim\Slim::registerAutoloader();
  $app = new \Slim\Slim();
  
  $app -&gt; get('/categories/', function() use ($app) {
      require_once ('../../libs/auth.inc');
      $auth = new Authentication();
      $user_id = $auth -&gt; SessionAuthenticate();
  
      require_once ('categories.php');
      $categories = new Categories();
      $categories -&gt; getCategories($app, $user_id);
  });
  
  $app -&gt; post('/categories/', function() use ($app) {
      require_once ('../../libs/auth.inc');
      $auth = new Authentication();
      $user_id = $auth -&gt; SessionAuthenticate();
  
      require_once ('categories.php');
      $categories = new Categories();
      $categories -&gt; saveCategory($app, $user_id);
  });
  
  $app -&gt; put('/categories/:category_id', function($category_id) use ($app) {
      require_once ('../../libs/auth.inc');
      $auth = new Authentication();
      $user_id = $auth -&gt; SessionAuthenticate();
  
      require_once ('categories.php');
      $categories = new Categories();
      $categories -&gt; saveCategory($app, $user_id);
  });
  
  $app -&gt; delete('/categories/:category_id', function ($category_id) use ($app) {
      require_once ('../../libs/auth.inc');
      $auth = new Authentication();
      $user_id = $auth -&gt; SessionAuthenticate();
  
      require_once('categories.php');
      $categories = new Categories();
      $categories -&gt; deleteCategory($app, $user_id, $category_id);
  });
  
  $app -&gt; run();
  </code></pre>
  
  <p>Here is my delete function on /rest/folder/categories.php</p>
  
  <pre><code>public function deleteCategory($app, $user_id,$category_id) {
      $requestBody = $app-&gt;request()-&gt;getBody();
      $params = json_decode($requestBody, true);
  
      $agreement_id = $params['agreement_id'];
  
      $con = $this-&gt;conectarDB();
      $query = "CALL SPD_CATEGORIES($category_id,$agreement_id);";
  
      //print_r($query);
  
      $result = $this-&gt;con-&gt;query($query);    
      $this-&gt;con-&gt;close();
      $app-&gt;status(200);
      echo json_encode($result);
  }
  </code></pre>
  
  <p>And here is my backbone delete function on /modules/folder/CategoriesView.js</p>
  
  <pre><code>confirmDeleteForm : function(event) {
      event.preventDefault();
      var category_id = $('#categories_select').select2("val");
      var self=this;
  
      this.category = this.categories.findWhere({'category_id':category_id});
      var agreement_id = this.category.get('agreement_id');
  
      $('#deleteModal').modal('hide');
  
      this.category.destroy({
          data: {
              'agreement_id': agreement_id,
          },
          processData : true,         
          success: function(model, response) {
  
              self.cleanForm();
              self.getCategories();
          },
          error: function(model, response) {
              if (response.status == 500) {
                  self.showErrorMessage('Se produjo un error en el servidor', 'ERROR');
              } else {
                  self.showErrorMessage(response.responseText, 'ATENCION');
              }
          }
      });
  
  },
  </code></pre>
  
  <p>In the model destroy I tried to add DATA: and HEADERS: but none of the work.</p>
  
  <p>Is it possible to be made?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>I've found this: <a href="http://docs.slimframework.com/routing/custom/#one-route-custom-http-methods" rel="nofollow">Slim v2</a>
   as referred in first answer.</p>
  
  <p>and this: <a href="http://backbonejs.org/docs/backbone.html" rel="nofollow">Backbone.js</a> (BACKBONE.ROUTER title)</p>
  
  <p>This is what I'm trying now. I really can get to work, but I think this is the way to resolve the issue I'm having.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Still can figure out how to do this. So, because of my almost-here deadline, I changed the database structure to only delete with a row ID.
  I will keep trying this after finishing the project.</p>
  
  <p>Thanks.</p>