我使用 quickbase 创建了包含以下 3 个字段的表
姓名,电子邮件,职位
现在我正在尝试通过带有 quickbase 的表 id 插入表中。
这是文档 API 链接 API 链接
这是 API 卷曲文档
curl -X POST 'https://api.quickbase.com/v1/records' \
-H 'QB-Realm-Hostname: {QB-Realm-Hostname}' \
-H 'User-Agent: {User-Agent}' \
-H 'Authorization: {Authorization}' \
-d {}
这是示例请求
{
"to": "bck7gp3q2",
"data": [
{
"6": {
"value": "This is my text"
},
"7": {
"value": 10
},
"8": {
"value": "2019-12-18T08:00:00.000Z"
},
"9": {
"value": [
"a",
"b"
]
},
"10": {
"value": true
},
"11": {
"value": "user@quickbase.com"
},
"12": {
"value": "www.quickbase.com"
},
"13": {
"value": [
{
"id": "123456.ab1s"
},
{
"id": "254789.mkgp"
},
{
"id": "789654.vc2s"
}
]
}
}
],
"fieldsToReturn": [
6,
7,
8,
9,
10,
11,
12,
13
]
}
到目前为止,这是我的努力 当我运行下面的代码时,出现以下错误
{"data":[],"metadata":{"createdRecordIds":[],"lineErrors":{"1":["Can not find record by ID \"My First post\"."]},"totalNumberOfRecordsProcessed":1,"unchangedRecordIds":[],"updatedRecordIds":[]}}{"data":[],"metadata":{"createdRecordIds":[],"lineErrors":{"1":["Can not find record by ID \"My First post\"."]},"totalNumberOfRecordsProcessed":1,"unchangedRecordIds":[],"updatedRecordIds":[]}}
这是我的代码
<?php
$access_t ="my_access_token-goes here";
$url="https://api.quickbase.com/v1/records";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
$useragent ='my-user-agent goes here';
$quicbase_domain= 'my-quickbase-domain-goes-here';
$data='
{
"to": "my-table-id-goes-here",
"data": [
{
"1": {
"value": "nancy more"
},
"2": {
"value": "nancy@gmail.com"
},
"3": {
"value": "My First post"
}
}
]
}
';
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"QB-Realm-Hostname: quicbase_domain",
"User-Agent: $useragent",
"Authorization: QB-USER-TOKEN $access_t",
'Content-Type:application/json'
));
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
echo $response = curl_exec($ch);
curl_close($ch);
print_r($response);