I'll try and answer (1) but ultimately you're the one that will need to be familiar enough with programming to really take it anywhere.
Accessing the QB API has many options, same as you would with any kind of client-side API call. You can use Axios, jQuery, Fetch, whatever you want. I do it different ways based on need, I've moved more towards using the REST API for various reasons and in codepages I typically have some flavor of the following function that I carry around:
const qb = {
tempToken: (dbid) => {
return new Promise((resolve,reject) => {
var headers = {
'QB-Realm-Hostname': '',
'QB-App-Token': '',
'Content-Type': 'application/json'
}
fetch(`https://api.quickbase.com/v1/auth/temporary/${dbid}`,
{
method: 'GET',
headers: headers,
credentials: 'include'
})
.then(res => {
if (res.ok) {
return res.json().then(res => resolve(res.temporaryAuthorization));
}
return res.json().then(resBody => reject({status: res.status, ...resBody}));
}).catch(err => reject(err))
})
},
fetchData: (token,body) => {
return new Promise((resolve,reject) => {
var headers = {
'QB-Realm-Hostname': '',
'Authorization': `QB-TEMP-TOKEN ${token}`,
'Content-Type': 'application/json'
}
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 => resolve(res));
}
return res.json().then(resBody => reject({status: res.status, ...resBody}));
}).catch(err => reject(err))
})
},
upsert: (commit,controller) => {
return new Promise((resolve,reject) => {
var headers = {
'QB-Realm-Hostname': '',
'Authorization': `QB-TEMP-TOKEN ${controller.token}`,
'Content-Type': 'application/json'
}
var body = {
to: controller.dbid,
data: commit.data,
mergeFieldId: commit.mergeFieldId,
fieldsToReturn: commit.fieldsToReturn
}
fetch('https://api.quickbase.com/v1/records',
{
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(res => {
if (res.ok) {
return res.json().then(res => resolve(res));
}
return res.json().then(resBody => reject({status: res.status, ...resBody}));
}).catch(err => reject(err))
})
}
}
Again - you don't have to do it that way - you could also use the XML API version and do something like axios.get(doquery url syntax) and then handle the resulting payload.
To question (2) - if you want to redirect them back to where they came from that's just a matter of using the window functions of your browser. You could do a history.back() entry or do window.location.replace( enter your url to return to here )
------------------------------
Chayce Duncan
------------------------------