gpt4 book ai didi

api - Google Scripts 应用程序和 Plaid 链接身份验证

转载 作者:行者123 更新时间:2023-12-05 07:01:42 28 4
gpt4 key购买 nike

我正在尝试创建一些代码来将我的银行交易下载到谷歌表格。我正在尝试通过使用谷歌脚本并对 Plaid 进行 API 调用来做到这一点。我目前设置了一个免费的沙盒帐户,但在过去几天尝试了几种方法后仍无法成功进行 api 调用。我还下载了 Postman,并从那里成功调用了电话。

这是我希望返回链接标记的代码主体。 ( Plaid Docs ) 我认为这是实现这一切的第一步。 ( Plaid Docs )

//1 - 创建链接 token

  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。我已经通过在线格式检查器运行我的 JSON,并且尝试过使用和不使用 stringify 选项发送 json。

谁能看出我可能遗漏了什么?我相信这是可能的,因为我已经看到至少一个似乎将 Plaid 与 Google 表格集成的附加解决方案。 BudgetSheets我有兴趣自己构建解决方案。

谢谢

最佳答案

您确定要发送 JSON 吗? documentation for UrlFetchApp.fetch没有提到 body 选项参数,而是使用 payload 参数。另外,我不确定它是否区分大小写,但以防万一,它的文档使用小写的 http 方法而不是大写的方法毫无意义。

关于api - Google Scripts 应用程序和 Plaid 链接身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63769552/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com