0
試圖瞭解Basecamp
的json
api。Basecamp json api post todo
獲取請求對我來說工作正常,但我似乎無法得到發佈的請求工作。 使用Google腳本。 任何人都可以看到這個bug嗎?我一直得到403,即使我是該帳戶的所有者和項目
function createBaseCampTodo(user, pw, email, appName, accountNumber,
projectNumber,todolistNumber) {
var url = "https://basecamp.com/"+accountNumber+"/api/v1/projects/"
+projectNumber+"/todolists/"+todolistNumber+"/todos.json";
var headers = {
"User-Agent": appName + " ("+email+")",
"contentType": "application/json",
"Authorization": "Basic " +
Utilities.base64Encode(user + ":" + pw)
};
var data = {
"content": "This is my new thing!",
"due_at": "2015-03-27"
};
var params = {
"method":"post",
"headers":headers,
"validateHttpsCertificates" :false,
//"muteHttpExceptions" : true,
"payload" : JSON.stringify(data)
};
var response = UrlFetchApp.fetch(url, params);
var text = response.getContentText();
Logger.log(text);
}