Wow, with that - immediate success :)
'method': 'POST' is indeed redundant in options (but doesn't appear to harm)
'body' is indeed the trick that makes it work, note that the guidance in prior comment was the confusing bit as it suggests 'data' instead (which may however be a valid construct in a JQuery Ajax call).
Johan Van Hoye
@Johan Van Hoye
0
Reputation
2
Posts
959
Profile views
0
Followers
0
Following
Posts made by Johan Van Hoye
-
RE: message":"Could not parse report template, aren't you missing content type?
-
RE: message":"Could not parse report template, aren't you missing content type?
Sorry, I just cannot get past this error. Trying to call the api from a standalone .js file in node, using request module.
I can get the call to work in PostMan. But in code I'm doing:options = {'method': 'POST', 'url': jsr, //valid string to report api 'headers': { 'User-Agent': 'request', 'Content-Type': 'application/json' }, 'data': JSON.stringify({ 'template': { 'shortid': reportId }, //valid short id 'data': req.data // a valid report data object (7751 chars) }) }; request.post(options).pipe(fs.createWriteStream(reportTargetFile));
whatever I try, I get {"message":"Could not parse report template, aren't you missing content type?"} as the contents of my file.
What am I doing wrong????