Zoho Survey触发函数invokeurl返回.json文件名而非内嵌JSON的问题
问题:Zoho Survey触发函数调用API无法直接获取Survey唯一URL
我需要在Survey 1的提交触发函数中,用提交的Response ID调用Zoho Survey API生成Survey 2的唯一URL,并写入关联的Zoho Sheet。
- 在PowerShell/curl中调用同一个API端点,能正常返回包含
unique_url的JSON数组 - 但用Deluge的
invokeurl调用时,虽然返回码200,responseText却是类似1771452061360.json的时间戳文件名,不知道这个文件的托管位置,也没法获取内容 - 尝试用
isFile(resp)判断返回结果是否为文件,日志显示resp is NOT a file,无法通过getFileContent()获取内容
现寻求获取该JSON文件内容的方法,或者直接获取unique_url/short_unique_url的替代方案。
当前Deluge代码
// Get URL responseId = survey.get("responseId"); respondentsList = List(); oneRec = Map(); oneRec.put("id", responseId.toString()); respondentsList.add(oneRec); payload = Map(); payload.put("respondentsList", respondentsList); resp = invokeurl [ url : "[survey url]" type : POST parameters : payload.toString() content-type : "application/json" headers : {"Accept":"application/json"} detailed : true connection : "surveyhub" ]; // Write to Zoho Sheet rowData = Map(); rowData.put("Response ID", responseId.toString()); rowData.put("URL for informed consent survey", ifnull(resp, "<NULL>").toString()); queryData = Map(); queryData.put("header_row", 1); resp2 = zoho.sheet.createRecords( "ahwg8d7233dc136d1410b98214920b1b551da", "Sheet1", rowData, queryData, "sheetsurvey" );
Zoho Sheet返回内容
{ "responseText": "1771452061360.json", "responseHeader": { "date": "Wed, 18 Feb 2026 22:01:01 GMT", "server": "ZGS", "content-length": "286", "set-cookie": "aprmjrnpkcrkks=61ca4324-3c5f-4ffe-9e2e-bdf1bfaea88c;path=/;SameSite=None;Secure;priority=high", "expires": "Thu, 01 Jan 1970 00:00:00 GMT", "x-content-type-options": "nosniff", "x-frame-options": "SAMEORIGIN", "content-type": "json;charset=UTF-8", "connection": "keep-alive", "cache-control": "private,no-cache,no-store,max-age=0,must-revalidate", "pragma": "no-cache", "strict-transport-security": "max-age=64072000; includeSubDomains; preload" }, "responseCode": 200 }
尝试添加的判断代码
if(isFile(resp)) { fileContent = resp.getFileContent(); info "fileContent = " + ifnull(fileContent,"<NULL>").toString(); } else { info "resp is NOT a file"; }
日志返回:resp is NOT a file
内容的提问来源于stack exchange,提问作者pakalla
相关产品推荐
相关产品推荐

