我无法将我的“ multipart / form-data”文件发送到此API。如果我使用POSTMAN,它可以工作,但是使用https post方法,似乎netsuite无法识别“ form-data”内容类型。知道如何使用SuiteScript 2发送表单数据?这是我的代码的一部分:
var fileObj = file.create({
name: invoiceNumber + '_ubl.xml',
fileType: file.Type.XMLDOC,
contents: einvoicecontentwithpdf,
folder : 120,
isOnline : false
});
var headers = {
'Authorization': 'Basic xxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'multipart/form-data'
};
var response = https.post({
url: 'https://community-api-uat-1-2.nxt.uat.unifiedpost.com/api/universal_connector/v1/uc/ar',
body: {
'file': fileObj
},
headers: headers
});
Run Code Online (Sandbox Code Playgroud)