0

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);
Marco
  • 22,856
  • 9
  • 75
  • 124
levi
  • 43
  • 1
  • 6

1 Answers1

0

I had the same issue and resolved it by making sure 'Developer mode' was turned on in Monday.com.

To do this, click on your profile icon > monday.labs > activate developer mode

desertnaut
  • 57,590
  • 26
  • 140
  • 166
hamish
  • 1