简体   繁体   English

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. 我正在尝试编写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.

相关问题 postman 返回 null,状态码为 200 - postman returning null with 200 status code 我需要$ http POST状态码400,但得到200 - I need $http POST Status code 400, but getting 200 Express Js Firebase SignOut() 立即向客户端 Fetch Post 请求返回状态 200 - Express Js Firebase SignOut() immeditately returning status 200 to client side Fetch Post request AJAX成功:功能始终返回成功(以及200状态代码),错误功能未触发 - AJAX success:function always returning success (and 200 status code), error function not triggering Zendesk 应用程序 POST 方法返回状态代码 200,但主体返回 null - Zendesk app POST method return status code 200 but body return null 如何显示进度条,直到获得POST呼叫的200状态代码 - How to show progress bar till i get a 200 status code of my POST call AngularJS发布返回状态代码304,而不是发布以播放后端 - AngularJS post returning status code 304 instead of posting to play backend 带参数的获取发布请求返回 400 状态代码? - Fetch Post Request with Parameters is returning 400 status code? Ajax成功事件在网络选项卡显示200状态代码的地方不起作用 - Ajax success event not working where network tab showing 200 status code Express端点对于POST返回404,对于GET返回200 - Express endpoint returning 404 for POST but 200 for GET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM