0

I am new to coding and monday.com Qraph QL. I have the following parse error when trying to compile my graph ql code to connect to monday.com and return values from a certain column:

Error:

{
  "errors": [
    {
      "message": "Parse error on \"function\" (IDENTIFIER) at [1, 1]",
      "locations": [
        {
          "line": 1,
          "column": 1
        }
      ]
    }
  ],
  "account_id": //my board ID is mentioned here
}

My Code:

function requestMonday(){
  var base_url = 'https://api.monday.com/v2';
  var api_key = 'Added my API key here'
  boards(limit:1, ids:[added my board ID here]) {
    name
    id
    items {
      name
      group {
        id
      }
      
      column_values(ids:[location]) {
        id
        value
        text
        
      }
    }
  }
}

}`
  
  var headers = {
    "Authorization": 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(respone);
    
    console.log("result::", result.data.boards[0]);

I would appreciate any feedback on how to resolve this issue. TIA

Lizzy
  • 137
  • 10

0 Answers0