UrlFetchApp POST無效,但返回狀態代碼:200

[英]UrlFetchApp POST not working, but returning Status Code: 200


I am attempting to write a Google apps script to add new users to a site. Here is my function:

我正在嘗試編寫Google應用腳本以向網站添加新用戶。這是我的功能:

function sendPost() {

var url = "https://www.blackstonelaunchpad.org/users/sign_up";
var options = {
  "method": "post",
  "headers": {
    "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "en-US,en;q=0.8",
    "cache-control": "no-cache",
    "connection": "keep-alive",
    "cookie": "cookievalye",
    "origin": "https://www.blackstonelaunchpad.org",
    "referer": "https://www.blackstonelaunchpad.org/users/sign_up",
    "upgrade-insecure-requests": "1",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36",
  },
  "payload": {
     "utf8":"✓",
     "authenticity_token":"C4KXrxZS7rOPT2cmnL2avpuq8BC7fhtz3rVVbwkjYvk=",
     "user[program_ids]":"X",
     "user[first_name]":"Test",
     "user[last_name]":"Test",
     "user[email]":"scriptTest@test.com",
     "user[password]":"test",
     "user[password_confirmation]":"test",
     "button":"",
   }
};
var response = UrlFetchApp.fetch(url, options);
Logger.clear() 
Logger.log(response.getResponseCode());

}

When i execute the script, a 200 status code is returned but no new user is added. Any help would be appreciated.

當我執行腳本時,返回200狀態代碼但沒有添加新用戶。任何幫助,將不勝感激。

1 个解决方案

#1


0  

Status 200 code is a success.

狀態200代碼是成功的。

Have you tried passing this using POSTMAN to see if it works?

您是否嘗試使用POSTMAN傳遞它以查看它是否有效?


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/06/16/72fd78a72a44ed0abada0c7413a4c7d0.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com