How can I directly mark complete / incomplete from PHP Api integration of Asana on my website

How can I directly mark complete / incomplete from PHP Api integration of Asana on my website.

Did you try to use the completed field?

1 Like

Hi Bastien,
I have followed the guide but bumped into error, I am using “Google Apps Script - Javascript”

function asana_update() {
  var updt    = '{"data": { "completed": true} }';
  var options = {
    "method"     : "PUT",
    "headers"    : {"Authorization": bearerToken},
    "contentType": 'application/json',
    "payload"    : updt
//    "payload"    : JSON.stringify(updt)
  };
  try {
    var url      = "https://app.asana.com/api/1.0/tasks/";
    var request  = UrlFetchApp.fetch(url+"828446317663433", options);
    var response = request.getContentText();
    return done;
  } 
  catch (e) {
    Logger.log(e);
  }
}

image

What did I do wrong?

And you are sure the id is the one of a task?

Hi Bastien, thanks for replying!

Yes I think so. Actually the whole thing under this particular workspace is either identifed as “Unknown Object” or “I dont have access” even though I created the workspace. I tried to update other task in different workspace, it works!

@johnnygoodnow any idea?