gpt4 book ai didi

node.js - 在 Asana Node.js 中创建任务

转载 作者:太空宇宙 更新时间:2023-11-04 01:56:45 27 4
gpt4 key购买 nike

在 Node 中使用以下内容尝试在 Workspace 中创建任务。我省略了 AccessToken 和 WorkspaceID 编号。怀疑我正在做一些非常愚蠢的事情:)

var asana = require('asana');
var client = asana.Client.create().useAccessToken('0/XXXXXXXX');
var newTask = { name: "Your Mission" };

client.tasks.createInWorkspace(1111111111, newTask).then(function(response) {
tasks = response.data;
console.log(tasks);
});

在运行时我得到以下输出...

Unhandled rejection Error: Invalid Request
at InvalidRequest.AsanaError (/Users/D/Asana_Crons/node_modules/asana/lib/errors/error.js:4:11)
at new InvalidRequest (/Users/D/Asana_Crons/node_modules/asana/lib/errors/invalid_request.js:5:14)
at Request._callback (/Users/D/Asana_Crons/node_modules/asana/lib/dispatcher.js:152:23)
at Request.self.callback (/Users/D/Asana_Crons/node_modules/request/request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/Users/D/Asana_Crons/node_modules/request/request.js:1163:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/Users/D/Asana_Crons/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1047:12)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)

最佳答案

我在您的代码中看到的唯一问题是工作区 ID 需要是字符串,而不是整数。这记录在 tasks section of /gen folder 中在 Asana Node 客户端库中。

关于node.js - 在 Asana Node.js 中创建任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47672779/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com