Asana POST任务

时间:2013-10-20 16:21:00

标签: node.js https asana

我正尝试使用以下节点/表达功能在体式中发布任务

exports.addTask = function(req, res) {
  var url ='/api/1.0/tasks?workspace=' + req.session.workspace_id
  var postBase = "app.asana.com";
  var options = {
    host: postBase,
    port: 443,
    path: url,
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': 'Bearer ' + JSON.parse(req.session.user).access_token,
    }
  };
  var req2 = https.request(options, function(res2) {
    res2.on('data', function(chunk) {
      console.log(chunk + "");
    });
    res2.on('error', function(e){
      console.log(e.message);
    });
  });

  req2.end();
}

我从asana那里得到了正确的答案:

{"data":{"id":8253508011735,"created_at":"2013-10-20T16:17:53.140Z","modified_at":"2013-10-20T16:17:53.140Z","name":"","notes":"","completed":false,"assignee_status":"upcoming","completed_at":null,"due_on":null,"workspace":{"id":1361701377437,"name":"getspur.com"},"assignee":null,"parent":null,"followers":[{"id":1050147548705,"name":"Gorkem Yurtseven"}],"projects":[],"tags":[]}}

但似乎没有在我的体式任务中添加任何东西..

PS。我目前在纽约的Facebook Hackathon,所以请带上它!

1 个答案:

答案 0 :(得分:1)

可能是因为受让人是空的,并且它不在任何项目中 - 这基本上使得无法找到(除非可能通过搜索?)

如果没有看到帖子正文,我不确定这是故意还是仅仅是格式问题。