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 构建的