Insert in Restful API with JQuery
I am having trouble uploading a record to QB table via Restful API / JQuery. I can pull records without issue. I can also go to the QB API portal and run the same code their without issue.
Even hardcoding the call with dummy data is not working. An internet search did not pull up anything that appeared to pertain to my situation. Can you take a look and see what I might be missing? (function below / error message attached)
headers = {
'QB-Realm-Hostname': 'somesite.quickbase.com',
'Authorization': 'QB-USER-TOKEN blahblahblah',
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'https://somesite.quickbase.com'
};
body = `{"to":"-TABLENAME-","data":[{"6":{"value":"Test Upload 8"},"10":{"value":"HTEST"}}]}`;
const result = await $.ajax({
url: 'https://api.quickbase.com/v1/records/query',
type: 'POST',
headers: headers,
data: JSON.stringify(body),
success: function (response) {
console.log("Success");
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
------------------------------
Jason Zeller
------------------------------