I'm developing a small script for operational tasks, and I need to delete rows from smartsheet using the API but I don't know what I am exactly doing wrong. This is my code:
function deleteRow(rowId){
var url = "https://api.smartsheet.com/2.0/sheets/"+sheet_id+"/rows";
Logger.log(rowId);
var options = {
"headers": {"authorization": "Bearer 4qg7ryl8bugi51ziuuq6a9mey0"},
"parameters": {"ids": "6469321685788548"},
"method": "delete",
"contentType": "application/json",
muteHttpExceptions: true
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);
}
sheet_id is where tasks are written. rowId is what i want to delete. The error I am getting is:
[17-12-27 12:28:12:149 CET] {
"errorCode" : 1009,
"message" : "A required parameter is missing from your request: ids.",
"refId" : "5er1e7ha2p0n"
}
Anybody knows how to make it work?
Thanks in return.
Looking here it doesn't appear that the options object you provide to UrlFetchApp.fetch() has a parameters attribute. Have you tried concatenating the query string for the row id you want to delete to the url variable you are creating?
var url = "https://api.smartsheet.com/2.0/sheets/"+sheet_id+"/rows?ids="+rowId