来自 asana 创建任务的奇怪的 500 个错误 api
bizarre 500 errors from asana create task api
我正在尝试使用 node.js asana 库创建一个新任务,但出现奇怪的 500 错误:
500 错误
{
message:"Server Error"
phrase: "29 bizarre cobras wait hourly"
}
创建代码
var task = {
name: card.name,
notes: card.desc,
memberships: [ { project: { id: someId, name: 'Discovery' }, section: section }],
parent:null,
workspace: workspaceId
};
client.tasks.create(task).then((results) => {
console.log(JSON.stringify(task));
}).catch((err) => {
console.error(err);
});
如error code documentation所述,"In the event of a server error the response body will contain an error phrase. These phrases are automatically generated using the node-asana-pharse library and can be used by Asana support to quickly look up the incident that caused the server error."
在这种情况下,错误是由于 POST 负载中的 memberships
参数格式不正确而产生的。 API 中作为参数的对象引用仅包括对象的 ID 而不是实际对象。
- 正确:
project: 123
- 不正确:
project: { id: 123, name: 'Discovery' }
因此,memberships 参数应该是
memberships: [ { project: 123, section: "A Section" }]
我正在尝试使用 node.js asana 库创建一个新任务,但出现奇怪的 500 错误:
500 错误
{
message:"Server Error"
phrase: "29 bizarre cobras wait hourly"
}
创建代码
var task = {
name: card.name,
notes: card.desc,
memberships: [ { project: { id: someId, name: 'Discovery' }, section: section }],
parent:null,
workspace: workspaceId
};
client.tasks.create(task).then((results) => {
console.log(JSON.stringify(task));
}).catch((err) => {
console.error(err);
});
如error code documentation所述,"In the event of a server error the response body will contain an error phrase. These phrases are automatically generated using the node-asana-pharse library and can be used by Asana support to quickly look up the incident that caused the server error."
在这种情况下,错误是由于 POST 负载中的 memberships
参数格式不正确而产生的。 API 中作为参数的对象引用仅包括对象的 ID 而不是实际对象。
- 正确:
project: 123
- 不正确:
project: { id: 123, name: 'Discovery' }
因此,memberships 参数应该是
memberships: [ { project: 123, section: "A Section" }]