×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Jonathan Vargas
Added: May 4, 2020 10:58 PM
Views: 4313
Tags: no tags
  1. require(["N/https", "N/file"], function (https, file) {
  2.  
  3.     var fileObj = file.load({id: 42460});
  4.  
  5.     var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"" + fileObj.name + "\"\r\nContent-Type: \"PLAINTEXT\"\r\n\r\n" + fileObj.getContents() + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
  6.  
  7.     var header = {'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'};
  8.  
  9.     var response = https.request({
  10.         method: https.Method.POST,
  11.         url: 'https://beta.payjoy.com/loans/v2/api/h2h-endpoint?action=upload&adminid=4006&token=PXzkQe83Hc1IR0f',
  12.         body: postData,
  13.         headers: header
  14.     });
  15.     log.debug('HOLO')
  16. });