我想执行一个Zoho并编写我的GAS
var result=UrlFetchApp.fetch('https://crm.zoho.com/crm/private/xml/Leads/insertRecords?authtoken=XXXXX&scope=crmapi&newFormat=1&xmlData=<Leads><row no="1"><FL val="Company">Your Company</FL><FL val="First Name">Hannah</FL><FL val="Last Name">Smith</FL><FL val="Email">testing@testing.com</FL></row></Leads>');我有一个错误
Argument non valide : https://crm.zoho.com/crm/private/xml/Leads/insertRecords?authtoken=XXXXXX&scope=crmapi&newFormat=1&xmlData=<Leads><row%20no="1"><FL%20val="Company">Your%20Company</FL><FL%20val="First%20Name">Hannah</FL><FL%20val="Last%20Name">Smith</FL><FL%20val="Email">testing@testing.com</FL></row></Leads> (ligne 35, fichier "MySQLtoZohoCRM")但是如果我在Chrome或FF中粘贴这个URL,它就会运行!
doc API
你知道为什么我在GAS而不是Chrome中有这个错误吗?
谢谢
发布于 2013-04-02 12:39:51
有两种形式的UrlFetchApp.fetch()
您使用的是第一个表单,但是您提供的参数没有通过验证,因为它不仅仅是一个URL。您应该使用第二种形式,将值放在“?”之后。作为选择。
试试这个:
var url = 'https://crm.zoho.com/crm/private/xml/Leads/insertRecords';
var xmlData = '<Leads><row no="1"><FL val="Company">Your Company</FL><FL val="First Name">Hannah</FL><FL val="Last Name">Smith</FL><FL val="Email">testing@testing.com</FL></row></Leads>';
var options =
{
'authtoken' : 'XXXXX',
'scope' : 'crmapi',
'newFormat' : '1',
'xmlData' : encodeURIComponent(xmlData)
}
var result=UrlFetchApp.fetch(url,options);
var output = Utilities.jsonParse(result.getContentText());
Logger.log(output); https://stackoverflow.com/questions/15763574
复制相似问题