0

I have a API which sends response in Text format as follows:

"521942","556463745.63","11/1/2016 12:00:00 AM","0","11/1/2016 12:00:00 AM" 
"521942","17848781.34","11/1/2016 12:00:00 AM","0","5/23/2016 12:00:00 AM" 
"521942","8038249.48","11/1/2016 12:00:00 AM","0","5/18/2015 12:00:00 AM"

I need to export this response into a CSV file but I am not able to do so. I tried using the File Object Method:

var filename = "abc"; 
var outFilePath = 'C:\\Users\\archit.goyal\\Downloads\\' + filename + '.csv'; 
var jsonObject = xml2Json(responseBody); 
var file = new File({writetofile: new File(outFilePath).write(ReportCSV)});

But this method is throwing error:

There was an error in evaluating the test script: ReferenceError: File is not defined

Please take a look into this issue and suggest.

mplungjan
  • 169,008
  • 28
  • 173
  • 236
Archit Goyal
  • 83
  • 1
  • 2
  • 6
  • Looks like it might be a dupe of https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript – mplungjan Jun 20 '18 at 12:30
  • If you're trying to do that all within the Postman UI (From the example in the question you are) - I've sure it doesn't actually provide that functionality. I might be wrong. – Danny Dainton Jun 20 '18 at 13:01

0 Answers0