我很可能做错了什么,但不确定是什么。我正在尝试使用 FF 海报测试 NetSuite Restlet(网络服务)。我可以通过在 URL 中传递数据来使用 Get 工作。但是,使用 Put 方法时出现错误。
{"error" : {"code" : "SYNTAX_ERROR", "message" : "SyntaxError: 空 JSON 字符串 (null$lib#3)。"}}
它击中了我下面的捕捉块。我读到创建或更新我们应该使用 Put 所以不确定为什么 Get 有效但 Put 无效?
function CreateRecord(jsonobject)
{
try
{
nlapiLogExecution('DEBUG', ' in get = ');
var jsonString = JSON.stringify(jsonobject)
nlapiLogExecution('ERROR', 'JSON', jsonString);
// Mandatory
var name = jsonobject["name"];
nlapiLogExecution('DEBUG', ' name = ', name);
var record = nlapiCreateRecord('customrecordtest');
record.setFieldValue('name', name);
var id = nlapiSubmitRecord(record, true);
nlapiLogExecution('DEBUG', 'id = ', id);
return jsonobject;
}
catch (err)
{
nlapiLogExecution('ERROR', 'Error', err.message);
return err.message;
}
}
海报:
https://rest.sandbox.netsuite.com/app/site/hosting/restlet.nl?script=351&deploy=1&name=Restlet测试