title: Node.js Request Module....sending json in body for api request with put
body: <p>I am using Node.js and the request module. I am trying to make a post request api(restfull) but it's not sending the request correctly. I can make this work in curl and in python's request module, but not the node.js request module:</p>
  
  <pre><code>var request = require('request');
  
  token = 'sfgsfsf';
  
  var options = {
      url: 'https://_rest_full_api
      headers: {
          'X-Auth-Token': token
      },
      body: {
          'status' : 'pending'
      },
      json: true,
      method: 'put'
  };
  
  function callback(error, response, body) {
      if (!error &amp;&amp; response.statusCode == 200) {
          var info = JSON.parse(body);
          console.log(info);
          console.log(info);
      } else {
          console.log(response.statusCode);
          console.log(response.body);
      }
  }
  
  request(options, callback); 
  
  
  SyntaxError: Unexpected token o
      at Object.parse (native)
      at Request.callback [as _callback] (/home/one/try.js:19:25)
      at Request.self.callback (/home/one/node_modules/request/request.js:122:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.&lt;anonymous&gt; (/home/one/node_modules/request/request.js:888:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.&lt;anonymous&gt; (/home/one/node_modules/request/request.js:839:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:920:16
      at process._tickCallback (node.js:415:13)
  </code></pre>