Skip to main content
Question

Insert in Restful API with JQuery

  • September 29, 2023
  • 0 replies
  • 156 views

Forum|alt.badge.img+1

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
------------------------------
This topic has been closed for replies.

MarceloBenavide
Forum|alt.badge.img+8

Hello, if you try insert, i think you need change  query  for  records:

url: 'api.quickbase.com/v1/records/query',  --->    https://api.quickbase.com/v1/records

Thank you

Marcelo Benavides Torres



------------------------------
Marcelo Benavides
------------------------------