Hi,
I’ve used some of the examples on here to develop an API load for data to a new board (the final location will change) and I’ve got the script creating the new item but it won’t load the content we want for the columns.
EG Item Name, Text Column, Date
Script happily creates the item but that is all. Board is mapped to the same structure etc so I’m not sure why this won’t run. Script is in Google App Script as we intend to use it to update regularly from a sheet, but we’re falling at thefirst hurdle.
I’ve looked at all the topics on here and the Quickstart guides.
function makeAPICall(key, query, variables) {
var url = “https://api.monday.com/v2”;
var options = {
“method” : “post”,
“headers” : {
"Authorization" : key,
},
“payload” : JSON.stringify({
"query" : query,
"variables" : variables
}),
“contentType” : “application/json”
};
var response = UrlFetchApp.fetch(url, options);
Logger.log("API results: " + response.getContentText());
return response;
}
function Create_Line() {
var mondayAPIkey = “YOUR KEY”
var boardID = YOUR BOARD
var variables = {
“myItemName” : “Hello, world!”,
“columnVals” : JSON.stringify({
"status" : {"label" : "Done"},
"date4" : {"date" : "1993-08-27"}
})
};
var query = ‘mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:’+boardID+‘, item_name:$myItemName, column_values:$columnVals) { id } }’;
makeAPICall(mondayAPIkey, query, variables);
}