AlexBennett3
5 years agoQrew Trainee
Re: QuickBase API "Query for Data" body help
UPDATE: I found my issue, it was in my syntax, I'm leaving the Array blank to include all fields from the designated table, but had my syntax formatted wrong due to trying to convert over from the method "GET" to "POST". Here is my updated API call for reference for anyone else having issues.
------------------------------
Alex Bennett
------------------------------
var headers = {
'QB-Realm-Hostname': 'XXXXXXXXXXXX.quickbase.com',
'User-Agent': 'FileService_Integration_V2.1',
'Authorization': 'QB-USER-TOKEN XXXXXXXX_XXXXXXXXX_XXXXXXXXXXXXXXXXX',
'Content-Type': 'application/json'
}
var body = {"from":"bpz99ram7","select":[],"sortBy":[{"fieldId":6,"order":"ASC"}],"groupBy":[{"fieldId":6,"grouping":"equal-values"}],"options":{"skip":0,"top":0,"compareWithAppLocalTime":false}}
fetch('https://api.quickbase.com/v1/records/query',
{
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(res => {
if (res.ok) {
return res.json().then(res => console.log(res));
}
return res.json().then(resBody => Promise.reject({status: res.status, ...resBody}));
})
.catch(err => console.log(err))
------------------------------
Alex Bennett
------------------------------