将Hello Sign API连接到应用程序脚本项目 [英] Connecting a Hello sign API to apps script project
问题描述
我想使用Google Apps脚本和Hello Sign API创建一个新的API应用
我已将重定向URL指定为)是不允许的方法",其中使用了错误的方法.在这种情况下, ContentService
使用特定的重定向模式(post-redirect-get wiki ),其中 POST
请求重定向到 script.google.com
( 302
)到 script.googleusercontent.com
上的一次性网址,其中的 GET
应该提出要求.
302
规范没有打算将方法从 POST
更改为 GET
,但是这种模式在网络中非常普遍.但是, hellosign-api 似乎向 script.googleusercontent.com
上的一次重定向URL发出另一个 POST
请求.从应用程序脚本更改此行为无能为力.可以更改为 HtmlService
以避免重定向,但是Hellosign特别要求您提供特定的文本内容作为响应: Hello API Event Received
.对于 HtmlService
,这是不可能的.
您可以提出功能请求/错误修复请求更改为 303 的重定向状态,明确指定将方法更改为 GET
的位置.或请求Hellosign遵循 302
使用 GET
请求重定向,因为这是最常见的方式,事情是在网络上完成的.
参考文献:
I want to Create a new API app usin Google Apps script and Hello sign API
I have specified the redirect URL as https://script.google.com/macros/s/AKfycbyKw3oLmpqINGsDml281iUbxBboKn950dqVFXNibMfLurxYcRPf/exec and the screenshot is shown below
Also, the code of the apps script file is
function doPost(e) {
return ContentService.createTextOutput("Hello API Event Received.");
}
The documentation says: https://app.hellosign.com/api/eventsAndCallbacksWalkthrough
I get error message as shown like here
Illustation image here
405
(http-status-code-405) is "method not allowed", where a incorrect method is used. In this case, ContentService
uses a specific pattern of redirection (post-redirect-getwiki), where the POST
request to script.google.com
is redirected(302
) to a one time url at script.googleusercontent.com
, to which a GET
request should be made.
302
specification did not intend the method to change from POST
to GET
, but this pattern is very common in the web. But, hellosign-api seems to make another POST
request to the one time redirected url at script.googleusercontent.com
. There isn't much you could do from apps script to change this behavior. It is possible to change to HtmlService
to avoid the redirection, but Hellosign specifically requires you to provide a specific text content as response: Hello API Event Received
. This isn't possible with HtmlService
.
You could make a feature request/bug fix request to Google to change redirect status to 303, where method change to GET
is explicitly specified. Or Make a request to Hellosign to follow 302
redirects with GET
request, as that is the most common way, things are done in the web.
References:
- Curl redirect preferred method -L
ContentService
Redirect- Post redirect get wiki
- RFC7231 § 6.4.3
- RFC7231 § 6.4.4
这篇关于将Hello Sign API连接到应用程序脚本项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!