Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Api Google脚本应用程序和Plaid链接验证_Api_Hyperlink_Scripting_Plaid - Fatal编程技术网

Api Google脚本应用程序和Plaid链接验证

Api Google脚本应用程序和Plaid链接验证,api,hyperlink,scripting,plaid,Api,Hyperlink,Scripting,Plaid,我正在尝试创建一些代码,以便将我的银行交易下载到google sheets。我正试图通过使用google脚本和对Plaid进行API调用来实现这一点。我目前有一个免费的沙盒帐户设置,但在过去几天尝试了一些事情后,未能成功地进行api调用。我还下载了《邮递员》,并从那里成功地拨打了电话 下面是我的代码主体,我希望返回一个链接令牌。我相信这是实现这一切的第一步。() //1-创建链接令牌 var data = { "client_id":"redacted&q

我正在尝试创建一些代码,以便将我的银行交易下载到google sheets。我正试图通过使用google脚本和对Plaid进行API调用来实现这一点。我目前有一个免费的沙盒帐户设置,但在过去几天尝试了一些事情后,未能成功地进行api调用。我还下载了《邮递员》,并从那里成功地拨打了电话

下面是我的代码主体,我希望返回一个链接令牌。我相信这是实现这一切的第一步。()

//1-创建链接令牌

  var data = {
   "client_id":"redacted",
   "secret":"redacted",
   "client_name":"Google Sheets Money",
   "country_codes":[
      "CA"
   ],
   "language":"en",
   "user":{
      "client_user_id":"unique_user_id"
   },
   "products":[
      "auth",
      "transactions"
   ]
 };
  
 var json = JSON.stringify(data);
  
 var options = {
     "method": "POST",
     "contentType": "application/json",
      "body": json,
      "muteHttpExceptions": true,
  };
  

  var response = UrlFetchApp.fetch("https://sandbox.plaid.com/link/token/create", options);

  Logger.log(response);
下面是我的记录器所说的:

{
  "display_message": null,
  "documentation_url": "https://plaid.com/docs/?ref=error#invalid-request-errors",
  "error_code": "INVALID_BODY",
  "error_message": "body could not be parsed as JSON",
  "error_type": "INVALID_REQUEST",
  "request_id": "0A86SP6KUD02oES",
  "suggested_action": null
}
一些谷歌搜索让我将contentType从headers部分移出。我已经通过一个在线格式检查器运行了我的JSON,并且我已经尝试了使用stringify选项和不使用stringify选项发送JSON

有人能看到我遗漏了什么吗?我相信这是可能的,因为我已经看到了至少一个附加解决方案,它似乎将Plaid与Google Sheets集成在一起。我对自己构建解决方案感兴趣


谢谢

您确定要发送JSON吗?没有提到
body
options参数,而是使用
payload
参数。另外,我不确定它是否区分大小写,但以防万一,它的文档使用小写的http方法,而不是大写的。

谢谢。我正在使用已知的GoodPostmanAPI调用,该调用使用“body”。我没有意识到选项参数依赖于UrlFetchApp。我认为它们是“普遍的”。我修改了代码,只是将“body”替换为“payload”,结果成功了。再次感谢,我正要放弃谷歌脚本,尝试其他东西。