MyoshiaBoykin-A
5 years agoQrew Trainee
Displaying reports on web pages using Javascript
I will start by admitting that I am not a "real" developer :). I have been working with the new RESTful API (thanks to Harrison) and I've been able to get a Success (200) within the QB API Portal; however, I can figure out how to embed the Javascript into a plain HTML page to render the report. I can worry about formatting and CSS later, I presume, but I just want to be able to test it and see the data first. I am just using ATOM to create the index.html page and I'm using XAMMP for the localhost. Can someone share with me how I would format the html to embed the following javascript code:
var headers = {
'QB-Realm-Hostname': 'xxxxxxxxxx',
'User-Agent': '{User-Agent}',
'Authorization': 'QB-USER-TOKEN xxxxx_xxxx_xxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
const xmlHttp = new XMLHttpRequest();
xmlHttp.open('POST', 'https://api.quickbase.com/v1/reports/10/run?tableId=xxxxxxxx&skip={skip}&top={top}', true);
for (const key in headers) {
xmlHttp.setRequestHeader(key, headers[key]);
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState === XMLHttpRequest.DONE) {
console.log(xmlHttp.responseText);
}
};
xmlHttp.send();
------------------------------
Myoshia Boykin-Anderson
------------------------------
var headers = {
'QB-Realm-Hostname': 'xxxxxxxxxx',
'User-Agent': '{User-Agent}',
'Authorization': 'QB-USER-TOKEN xxxxx_xxxx_xxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json'
}
const xmlHttp = new XMLHttpRequest();
xmlHttp.open('POST', 'https://api.quickbase.com/v1/reports/10/run?tableId=xxxxxxxx&skip={skip}&top={top}', true);
for (const key in headers) {
xmlHttp.setRequestHeader(key, headers[key]);
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState === XMLHttpRequest.DONE) {
console.log(xmlHttp.responseText);
}
};
xmlHttp.send();
------------------------------
Myoshia Boykin-Anderson
------------------------------