LoginSignup
6
4

More than 5 years have passed since last update.

Google Apps ScriptでPostする

Last updated at Posted at 2019-04-12

webhookで定期実行しようと思ったものの、postがうまくいかずに苦戦しました。

postはUrlFetchAppでできるって書いてあったんですが、muteHttpExceptionsでエラーが発生。
muteHttpExceptionsの設定をtrueに変えてあげれば通る。


var web_url = "https://hogehoge.com";
var options = {
   "text" : "post"
};
var response = UrlFetchApp.fetch(
    web_url,
    {
        method: "POST",
        contentType: "application/json",
        payload: JSON.stringify(options),
        muteHttpExceptions: true,
    }
);
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4