使用Asana API创建Asana任务会产生无效的标识符错误

时间:2018-10-26 13:08:56

标签: javascript asana-api

我的有效载荷看起来像这样。

var data={
                  "workspace":"1234",
                   "name": task_name ,
                   "notes":striped_msg ,
                   "memberships":[
                     {
                       "project":678,
                        "section":111
                      },
                     {
                       "project":1230
                     }
                   ],
                    "custom_fields":{
                       "303093523672299":"303093523672300"
                        },
                       "due_on":string_date
                     }

像这样发送有效载荷。

 var status = await asanaService.addTask(JSON.stringify(data))

得到以下错误消息

{"errors":[{"message":"Could not interpret {\"workspace\":"1234",\"name\":\"rohit as an identifier in {\"workspace\":"1234",\"name\":\"rohit.one [ Mysql cpu ]\",\"notes\":..............","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}

1 个答案:

答案 0 :(得分:0)

我在发布期间缺少JSON标头