Tuesday, 6 June 2017

unable to get JSON data from Restlet Client using Node Js

(I am totally new to Restlet client and Server scripting)

I am trying to get JSON Data from response body of the Restlet client using below code but I could not get that

var http = require('http');
var options = {
  host: 'staging.api.pearson.com',
  port: 80,
  path: '/sc-api/apis/content/urn:pearson:manifestation:db7eac5b-8f65-49dc-97bc-d0f5e824f135'
};

http.get(options, function(res) {
  console.log("Got response: " + res.statusCode);

  res.on("data", function(chunk) {
    console.log("BODY: " + chunk);
  });
}).on('error', function(e) {
  console.log("Got error: " + e.message);
});

Getting the below output:

enter image description here

But when using the Restlet client GUI, can able download the response BODY Json

enter image description here

Kindly anybody suggest any way to do

(I am totally new to Restlet client and Server scripting)

Thanks



via Elambarathi Vimal Kannan

No comments:

Post a Comment