Upload file through NetSuite Suitelet script

新規投稿

コメント

4件のコメント

  • Box Product Support

    Were you ever able to upload a file to Box using SuiteScript?

    0
    コメントアクション パーマリンク
  • PardeepChopra

    Nope 

     

    0
    コメントアクション パーマリンク
  • Shiv Rastogi

    Hello Box Team,

    I've developed a NetSuite script1.0 to download and upload a file from BOX's folder.

    (a) From Box to NetSuite I'm able to download file through NetSuite script using Box Api and working fine however

    (b) I'm trying to upload file From NetSuite to Box's folder, always getting error response code-415 (i.e. Box Error: 'Unsupported Media Type).

    Could you please check below codes and suggest the required modification in code?

    function postFileNetSuiteS2BOX(boxFolderId, nsFileId, boxApiAccessToken)
    {

    var restUrl = 'https://upload.box.com/api/2.0/files/content/';
    var restHeaders = new Array();
    restHeaders['Content-Type']='multipart/form-data';
    restHeaders['Authorization'] = 'Bearer ' + boxApiAccessToken;
    var fileObj = nlapiLoadFile(nsFileId); //Load excell file
    var fileURL = fileObj.getURL(); //file url of NetSuite file cabinet's folder
    var nsFileType = fileObj.type;
    var fileContent = fileObj.getValue(); //Content of excel file
    var nsFileName = fileObj.getName(); //Name of excel file
    var parent = { 'id': boxFolderId.toString()};
    var attribs = { 'name' : nsFileNameStr.toString(), 'parent' :parent};
    var body = { 'attributes' : attribs, 'file' : fileURL};
    nlapiLogExecution('DEBUG', 'File Attributes', JSON.stringify(body));
    var postReq = nlapiRequestURL(restUrl, body, restHeaders, null, "POST");
    return postReq;
    }

    Your quick response will highly apricated!

    Thanks,

    Shiv Rastogi

    0
    コメントアクション パーマリンク
  • Steven Oakes

    Shiv,

    How were you able to download a file FROM Box TO Netsuite using suitescripts?

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。