Skip to main content

I have tried to code in google script editor and i am not able to what is the issue is the query

the code is pasted below.

function makeAPICall(key, query) {

var url = “api.monday.com/v2”;

var options = {

“method” : “post”,

“headers” : {“Authorization” : key,},

“payload” : JSON.stringify({“query” : query}),

“contentType” : “application/json”

};

//Logger.log(options);

var response = UrlFetchApp.fetch(url,options);

Logger.log("API results: " + response.getContentText());

//return response;

}


function getValueMonday(){

var mondayAPIkey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;

var boardID = 457712781;

var query = “mutation{create_item(board_id:457712781, item_name:‘name’){id}}”;

var worked = makeAPICall(mondayAPIkey, query);

Logger.log("Pulse ID returned was " + worked);

}


The Error is:

API results: {“errors”:>{“message”:“No query string was present”}],“account_id”:3669886}

Hi there @akashub


Alex here, I’m happy to help! I’m really sorry for the delay on our end to get back to you regarding this issue - we are hoping to increase our responsiveness in the community now to a higher standard 🙂


It seems like the query you are sending is not formatted as a query, as you need to declare this is a mutation query. You can find more info on this here:


API Quickstart Tutorial - Javascript


Let me know if that is helpful 🙂


-Alex