1
 url = 'https://api.twilio.com/2010-04-01/Accounts/'+ACCOUNT_SID+'/SMS/Messages/'+Sid+'.json';

 var payLoadData = {
          'SMSMessageSid' : Sid
        };
 var options =
      {
        method : "GET",
        payload : payLoadData,
        headers : {
          'Authorization' : 'Basic ' + Utilities.base64Encode(ACCOUNT_SID + ':' + ACCOUNT_TOKEN)
        }
      };

  var response = UrlFetchApp.fetch(url, options);

为什么使用这个 google_script 会给出 Method_Not_Allowed

Request failed for https://api.twilio.com/2010-04-01/Accounts/XXXXXXXXXXXXX/SMS/Messages/XXXXXXXXXXXXXXXXXXXXX.json returned code 405. Server response: {"status":405,"message":"Method not allowed","code":20004,"more_info":"http:\/\/www.twilio.com\/docs\/errors\/20004"} (line 374, file "MakePhoneCall")

如我们所见,https://www.twilio.com/user/account/developer-tools/api-explorer#GET/2010-04-01/Accounts/[AccountSid]/SMS/Messages/[SMSMessageSid]。[格式]

它是根据这个 api ref 构建的

4

1 回答 1

1

似乎在使用 GET 方法时不应使用有效负载,因此使用参数就可以了。

尽管如此,在获取通话详细信息时,相同的方法仍然有效,但不适用于消息,有趣:)

于 2013-07-02T15:05:19.680 回答