AlexBennett3
4 years agoQrew Trainee
QuickBase API "Query for Data" body help
Hey Everyone,
I'm attempting to do an API call in an external application to pull some data over from our QuickBase to be able to manipulate other charts and graphs outside of QuickBase based on these field data values.
I wondered if anyone had any input on how to form the body properly, I'm reading maybe using the API_DoQuery call with clist of all field ID's? I was able to make the call getting the field id's at names pulled over, but no data yet.
Again, the idea is to pull over field values to be able to be used in custom software charts and graphs based on what is in these fields in QuickBase.
Any help would be greatly appreciated!
Edit: I know the "select" array for field ID's is blank, when I added field ID's I still got errors.
This code also works and I can see in my Console that I'm getting all the field ID's from that table and their corresponding field names, but not values which is why I'm attempting to switch to "Query for Data".
Thanks!!
------------------------------
Alex Bennett
------------------------------
I'm attempting to do an API call in an external application to pull some data over from our QuickBase to be able to manipulate other charts and graphs outside of QuickBase based on these field data values.
I wondered if anyone had any input on how to form the body properly, I'm reading maybe using the API_DoQuery call with clist of all field ID's? I was able to make the call getting the field id's at names pulled over, but no data yet.
var headers = {
'QB-Realm-Hostname': 'XXXXXXXXX.quickbase.com',
'User-Agent': 'FileService_Integration_V2.1',
'Authorization': 'QB-USER-TOKEN XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'Content-Type': 'application/json'
}
// var body = {
// "from": "bpz99ram7",
// "select": [],
// "sortBy": [
// {
// "fieldId": 6,
// "order": "ASC"
// },
// ],
// }
fetch('https://api.quickbase.com/v1/fields/usage?tableId=bpz99ram7&skip=0&top=0',
{
method: 'GET',
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))
As you can see above, I've commented out the 'body' and changed the method to GET, I believe I need to have the body with the field ID's being pulled over, and changing the method type to POST, but am getting 405 error (Method Not Allowed) whenever I attempt to use a body and method type of POST. Again, the idea is to pull over field values to be able to be used in custom software charts and graphs based on what is in these fields in QuickBase.
Any help would be greatly appreciated!
Edit: I know the "select" array for field ID's is blank, when I added field ID's I still got errors.
This code also works and I can see in my Console that I'm getting all the field ID's from that table and their corresponding field names, but not values which is why I'm attempting to switch to "Query for Data".
Thanks!!
------------------------------
Alex Bennett
------------------------------