Here is the documentation for the api:
curl -g "https://api.com" \
-H "Authorization: Bearer $api-key" \
-H "Accept: application/vnd.api+json"
Here's what I have. And its not working. Please help. Any advice would be really appreciated it. I am new to web development but really enjoy it.
var request = new XMLHttpRequest();
request.open("GET", "https://api.com", false);
request.setRequestHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9");
requset.setRequestHeader("Accept", "application/vnd.api+json");
request.send();
var response = JSON.parse(request.responseText);
var thetables = document.getElementById("Main");
var row = document.createElement("tr");
var cell1 = document.createElement("td");
var cellText = document.createTextNode(namez);
cell1.appendChild(cellText)
var cell2 = document.createElement("td");
var cellText1 = document.createTextNode(response[0]);
cell2.appendChild(cellText1)
var cell3 = document.createElement("td");
var cellText2 = document.createTextNode(response[1]);
cell3.appendChild(cellText2)
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3)
thetables.appendChild(row);