RE: 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=
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.
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.
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.
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)