Are you receiving SNAP/EBT benefits? The campaign is live and accepting new members. Learn more about receiving $50 for submitting a SNAP receipt and $50 for getting your COVID-19 vaccine here and join today!

Expensify <> NetSuite RESTlet Export PDFs

miggyesca Expensify Customer Posts: 3 Expensify Newcomer
edited December 2021 in Integrations and API

Is there a way to properly export and render PDFs coming from Expensify to NetSuite via a RESTlet?

I tried doing this in POSTman with ease, as it displays the PDF on its GUI. However, in NetSuite, I'm having trouble converting the actual response returned by Expensify and rendering it to a proper PDF file.

Here's a snippet of my code:

           var headerInput = {
                "content-type": "application/pdf",
                "content-disposition": "attachment;filename=MyFile.pdf"

           var response2 ={
                    url: '{"type": "download","credentials": {"partnerUserID": xxxxx","partnerUserSecret": "xxxx"},"fileName": "'+response1.body+'","fileSystem": "integrationServer"}',
                    body: null,
                    headers: headerInput

      var fileObj = file.create({
              name: 'test.pdf',
              fileType: file.Type.PDF,
              contents: response2.body,
             folder: xxx,

PDF file produced shows a blank page, and a blank page as well if I writeFile it on a Suitelet.

Any ideas?