Downloading invoice documents (PDF) from REST or SOAP API

Is it possible to download the invoice PDF via the REST (preferred) or SOAP API?

In the interface I can find them here:

https://REDACTED-sb1.app.netsuite.com/app/common/media/mediaitemfolders.nl?folder=-9&whence=

Rookie Asked on June 19, 2020 in SuiteTalk.
Add Comment
3 Answer(s)

If you can call a Restlet (could be the name / internalid of a file), the response could be the content of a pdf in the filecabinet , yes.

Beginner Answered on June 19, 2020.

Thanks for your answer Nelliott.

We are trying to build a generic integration for multiple clients. This requires us to create a custom script for each of our clients, correct? I assume this is not possible via the default REST API? Maybe via a custom field?

on June 19, 2020.

To clarify, if you’re looking to create a RESTlet that returns a PDF from the filecabinet, this could be quite simple.

You would need to pass in something that identifies the file by name if you do not know the internal id of the file in the filecabinet.

The RESTlet would search for the file, load and return the content as base64 encoded content or a suitable message if the file is not found.
You could manage access via access tokens with one RESTlet serving all clients.

on June 22, 2020.
Add Comment

Take a look at the SOAP web services record guide for File. Expect to do a folder or file search to get the file internal ids required to use it.

Advanced Answered on June 19, 2020.
Add Comment

If Invoice pdf already existed in file cabinet then create RestLet load record and send a complete object as API response. And can save API response in .pdf format and it will work.

Beginner Answered on June 25, 2020.

Thanks, I’ve got this working. However, this is not an ideal solution as the RESTLET url will be different for each client. This will take extra setup time and a need to store the RESTLET url per customer.

Would be great if there was a dedicated API route that returns the file contents when you request a specific file id.

on June 25, 2020.

You should be able to use one RestLet Url and just manage access tokens to allow multiple users to access it, not sure why you believe you need separate urls unless your code needs to work differently for different users?

In which case you could just add a parameter to the url which identifies the user and branch the code accordingly. (admittedly at that point the url would be different just not the base url/RestLet)

Also if you know the id of the file you can just load and return it, it’s only if you have to search for the file it adds an extra step.

on June 26, 2020.

We serve multiple clients independent of eachother. So every client has their own Netsuite environment.

They all need to install the RESTLET code, which leads to different urls. (The same goes for the different CLIENT_ID and CLIENT_SECRET)

on June 27, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor