Is there a way to send a parameter as the post body to an API while also including the required Authorization header with the API key?
- How can I include a post body request with data set as "server_id: 12345"?
- What is the method to display the JSON response from the API on my webpage?
document.getElementById("1").addEventListener("click", PowerOff);
function PowerOff() {
"";
console.log("Doing");
fetch(url, {
method: "POST",
headers: {
Authorization: "CrocodileZebraGiraffe",
"Content-Type": "application/json",
}
});
}