Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple NetSuite SuiteScript 2.0 RESTlet to gather file information, since the basic call does not return the file contents.
/**
* @NApiVersion 2.x
* @NScriptType Restlet
* @NModuleScope SameAccount
* @Author Charles.Bastian
* @Created 2019-03-13
* @ScriptName REST_Query_File_Contents_by_InternalID
* @Filename REST_Query_File_Contents_by_InternalID.js
* @ScriptID customscript_rest_get_file_contents
* @Production
* @FileID
* @InternalURL
* @ExternalURL
* @SearchURL
* @SandBox
* @FileID
* @InternalURL
* @ExternalURL N/A
*
* @modifications
* Date Author Version Remarks
* 2019-03-13 Charles.Bastian v1.3.13-1 Created
*
*
*/
define(['N/search','N/record','N/file'],function(search,record,file){
/**
* Function called upon sending a GET request to the RESTlet.
*/
function doGet(requestParams){
log.debug('in doGet',JSON.stringify(requestParams.fileNSID));
if(requestParams.fileNSID!==undefined){
if(requestParams.fileNSID!=''){
return findFileByInternalID(requestParams.fileNSID);
}else{
return JSON.stringify({'ERROR[E0]':'No NetSuite internal ID value received.'});
}
}else{
return JSON.stringify({'ERROR[E1]':'Missing fileNSID parameter'});
}
}
/**
* Sample PDF file results (contents are Base64):
* {
* "fileObj":{"type":"file.File","id":"35","name":"Dummy PDF","description":null,"path":"Testing/Dummy PDF.pdf","url":"/core/media/media.nl?id=35&c=5113975_SB1&h=cd6fc45ef715384b451d&_xt=.pdf","folder":11,"fileType":"PDF","isText":false,"size":13264,"encoding":"UTF-8","isInactive":false,"isOnline":false},
* "fileContents":"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nD2OywoCMQxF9/mKu3YRk7bptDAIDuh+oOAP+AAXgrOZ37etjmSTe3ISIljpDYGwwrKxRwrKGcsNlx1e31mt5UFTIYucMFiqcrlif1ZobP0do6g48eIPKE+ydk6aM0roJG/RegwcNhDr5tChd+z+miTJnWqoT/3oUabOToVmmvEB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MDEyNDk0IDAwMDAwIG4gCnRyYWlsZXIKPDwvU2l6ZSAxNi9Sb290IDE0IDAgUgovSW5mbyAxNSAwIFIKL0lEIFsgPEY3RDc3QjNEMjJCOUY5MjgyOUQ0OUZGNUQ3OEI4RjI4Pgo8RjdENzdCM0QyMkI5RjkyODI5RDQ5RkY1RDc4QjhGMjg+IF0KPj4Kc3RhcnR4cmVmCjEyNzg3CiUlRU9GCg=="
* }
*
* Sample Text file results contents are PlainText):
* {
* "fileObj":{"type":"file.File","id":"34","name":"testing.txt","description":null,"path":"Testing/testing.txt","url":"/core/media/media.nl?id=34&c=5113975_SB1&h=cb1910a1314154c38fda&mv=jt7j5hww&_xt=.txt","folder":11,"fileType":"PLAINTEXT","isText":true,"size":50,"encoding":"UTF-8","isInactive":false,"isOnline":false},
* "fileContents":"sdfgdasfgsdafgsdfgdsfg\r\nsdfgsdfgsdfg\r\nsdfgsdfgsdfg"
* }
*/
function findFileByInternalID(nsID){
var respObj={};
var fileObj=file.load({id:nsID});
try{
if(fileObj){
log.debug('fileObj',JSON.stringify(fileObj.getContents()));
respObj={'fileObj':fileObj,'fileContents':fileObj.getContents()};
}else{
respObj=JSON.stringify({'ERROR[E2]':'No File with NetSuite internal ID: '+nsID+' found.'});
}
log.debug('respObj',JSON.stringify(respObj));
}catch(E3){
return JSON.stringify({'ERROR[E3]':JSON.stringify(E3.message)});
}
return JSON.stringify(respObj);
}
return{
'get':doGet
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment