I'm trying to get an api request, and in order to do that i need to pass an authentication token. in what way can i do that? ( in the tutorial i followed, they used SECRETS folder in apps scripts.. couldnt find any info about it.)
- i tryied hard coding the authentication token and passing it as a string, but it did not work. i got the error:
"Exception: Request failed for https://api.monday.com returned code 401. Truncated server response: {"errors":["Not Authenticated"]} (use muteHttpExceptions option to examine full response)"
thanks!
function requestMonday() {
var base_url = "https://api.monday.com/v2"
var api_key = ?????? // WHAT DO I PUT HERE????
var query = "query { boards (limit:1){id name} }"
var headers = {
"Authentication": api_key,
"Content-Type":"application/json"
}
var options ={
headers: headers,
method:"POST",
payload:JSON.stringify({
query:query
})
}
var response =UrlFetchApp.fetch(base_url,options).getContentText();
var result = JSON.parse(response);
console.log("result::", result);