Prestan
Prestan copied to clipboard
JSON format not returned
Hi,
Passing the param output_format='JSON' it should return a JSON output, but I get the following error: Requesting[get] http://www.xxxxxxxxxxxxxxx.com/api/products/?output_format=JSON with options {} { [Error: Non-whitespace before first tag. Line: 0 Column: 1 Char: {] cause: [Error: Non-whitespace before first tag. Line: 0 Column: 1 Char: {], isOperational: true }
Can you post the code you're using?
Here's the code:
var Prestan = require('./index.js');
prestan = new Prestan('http://www.xxxxxxxxxxx.com', 'XXXXXXXXXXXXXXXXXXX', {debug: true});
prestan.get('products',{output_format: 'JSON'}).then(function(response) {
console.log(response);
}).catch(function(errors) {
console.log(errors);
});
The output I get is the one from first comment. Going to the URL in the output shows de JSON object.
You don't need {output_format: 'JSON'}, JSON is returned from the parser.