I created table with the following 3 fields with quickbase
name,email,post
Now am trying to insert into the table via table id with quickbase.
here is the documentation API Link API lINK
here is the API Curl documentation
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 {}
here is the sample request
{
"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
]
}
Here is my effort so far When I run the code below, I have the following error
{"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":[]}}
here is my code
<?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);