[英]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. 我正在尝试编写Google Apps脚本以将新用户添加到网站。 Here is my function: 这是我的功能:
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. 当我执行脚本时,将返回200状态代码,但未添加新用户。 Any help would be appreciated. 任何帮助,将不胜感激。
Status 200 code is a success. 状态200代码成功。
Have you tried passing this using POSTMAN to see if it works? 您是否尝试过使用POSTMAN传递此消息以查看其是否有效?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.