var request = require('request');
//******GLOBAL***************
var SESSIONKEY = "";
var options = {
  url: "https://xxxxxxxxxxxxxxxx/index.php/admin/remotecontrol",
  method: "POST",
  headers: {
    'user-agent': 'Apache-HttpClient/4.2.2 (java 1.5)',
    'host': 'xxxxxxxxxxxxxxxx',
    'path': '/index.php/admin/remotecontrol',
    'connection': 'keep-alive',
    'content-type': 'application/json'
  }
};
//*******AUTHENTIFICATION*******
options.body = JSON.stringify({
  method: 'get_session_key',
  params: ['myusername', 'mypassword'],
  id: 1
});
request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    body = JSON.parse(body);
    //*********KEEP THE KEY*********  
    if (SESSIONKEY === "") {
      console.log("NEW KEY -->" + body.result);
      SESSIONKEY = body.result;
      nextFonction();
    }
  } else console.log("ERROR -->" + body);
});
Limesurvey version - 3.0.1
After running this code , I am getting blank body and showing error
SyntaxError: Unexpected end of JSON input at JSON.parse ()
This error is getting due to blank response from limesurvey. How can I solve this error? Or is there any othere way to get SessionKey from limesurvey? Please help.