简体   繁体   English

从使用 Google Apps 脚本登录的 Google 帐户发送 POST 请求

[英]Send a POST request from the Google account that’s signed in with Google Apps Script

I try to find a way to submit a response to a Google Form that I do not have edit access to with Google Apps Script.我试图找到一种方法来提交对我没有使用 Google Apps 脚本进行编辑访问的 Google 表单的回复。 Both of the FormApp.openById(id) and FormApp.openByUrl(url) methods need the user who is signed in to have edit access to the form, so I can't use those. FormApp.openById(id) 和 FormApp.openByUrl(url) 方法都需要登录的用户对表单具有编辑权限,所以我不能使用它们。 The request has to come from my account because the Google Form keeps track of which account each response is from.该请求必须来自我的帐户,因为 Google 表单会跟踪每个响应来自哪个帐户。

I know that it is possible to pre-fill a Google Form by adding values for specific fields on the end of the link.我知道可以通过在链接末尾添加特定字段的值来预先填写 Google 表单。 It is also possible to respond to a Google Form like that with just a POST request.也可以只用一个 POST 请求来响应这样的 Google 表单。 However, I have only been able to make this work for Google Forms that don't need the user to be signed in.但是,我只能为不需要用户登录的 Google Forms 完成这项工作。

To solve this problem, it would be great if there was a way to send a POST request from the Google account that is signed in.为了解决这个问题,如果有一种方法可以从登录的 Google 帐户发送 POST 请求,那就太好了。

Currently, it is not possible to submit a Google Form without edit access.目前,无法提交没有编辑权限的 Google 表单。 As you mentioned you can only make this work for Google Forms that don't need the user to be signed in (either by server-side POST or URL redirection on client-side).正如您所提到的,您只能对不需要用户登录的 Google Forms 进行这项工作(通过服务器端 POST 或客户端上的 URL 重定向)。

Alternatively, client-side redirection will allow you to submit the Google form for the signed-in user, but it will show the google form's confirmation message.或者,客户端重定向将允许您为登录用户提交 Google 表单,但它会显示 google 表单的确认消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM