ChristopherWhe2
5 years agoQrew Trainee
Uncaught TypeError: JSON.Stringify is not a function
Hello,
I'm trying to utilize the new REST API and am getting an error when I call the below script, which I've put in a code page. Am I missing something simple here?
---
var headers = {
'QB-Realm-Hostname': '{OUR REALM}',
'Authorization': 'QB-USER-TOKEN {MY USER TOKEN}',
'Content-Type': 'application/json'
}
var body = {
"from": "{MY TABLE}",
"select": [
20,
22,
23,
24,
25,
29,
31,
33
],
"where": "{'6'.Ex.'Yes'}AND{'20'.Ex.'New York'}"
}
fetch('https://api.quickbase.com/v1/records/query',
{
method: 'POST',
headers: headers,
data: JSON.Stringify(body)
})
.then(res => {
if (res.ok) {
return res.json().then(res => console.log(res));
}
return Promise.reject({ status: res.status, statusText: res.statusText });
})
.catch(err => console.log(err))
---
------------------------------
Christopher Wheatley
------------------------------
I'm trying to utilize the new REST API and am getting an error when I call the below script, which I've put in a code page. Am I missing something simple here?
---
var headers = {
'QB-Realm-Hostname': '{OUR REALM}',
'Authorization': 'QB-USER-TOKEN {MY USER TOKEN}',
'Content-Type': 'application/json'
}
var body = {
"from": "{MY TABLE}",
"select": [
20,
22,
23,
24,
25,
29,
31,
33
],
"where": "{'6'.Ex.'Yes'}AND{'20'.Ex.'New York'}"
}
fetch('https://api.quickbase.com/v1/records/query',
{
method: 'POST',
headers: headers,
data: JSON.Stringify(body)
})
.then(res => {
if (res.ok) {
return res.json().then(res => console.log(res));
}
return Promise.reject({ status: res.status, statusText: res.statusText });
})
.catch(err => console.log(err))
---
------------------------------
Christopher Wheatley
------------------------------