我在 Google 脚本中有以下代码:
var data = {
"records": [
{
"fields": {
"Contract Address": "test",
"0x8df3aad3a84da6b69a4da8aec3ea40d9091b2ac4": "1234"
}
}
]
};
var options = {
"method" : "post",
'Content-Type': 'application/json',
'muteHttpExceptions' : true,
// "payload" : data,
"payload" : JSON.stringify(data)
};
function tryAPost(){
var url = "https://api.airtable.com/v0/xxxxxxxxxxxxx/Balance%20Tracking?api_key=keyxxxxxxxxxx";
var response = UrlFetchApp.fetch(url, options);
//console.log(response.getContentText());
console.log(response.getResponseCode());
};
我得到以下回复:
422
并且数据不会最终出现在 Airtable 中。
有效负载在 Postman 中的发布请求正文中工作。
我究竟做错了什么?
编辑每条评论:
这是airtable的示例代码:
var Airtable = require('airtable');
var base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('xxxxxxxxxxxx');
base('Balance Tracking').create([
{
"fields": {
"Contract Address": "Thu, 03 Feb 2022 15:12:37 GMT",
"0xfecf784f48125ccb7d8855cdda7c5ed6b5024cb3": 12055358359168