Asana REST API - 将文件附加到任务

时间:2015-04-28 12:53:45

标签: rest asana asana-api

我正在尝试通过REST API将文件附加到Asana中的任务,并且我收到超时错误。我相信错误来自Asana方面,所以我有点卡住......

我正在制作的请求具有以下格式

POST https://app.asana.com/api/1.0/tasks/<my task>/attachments HTTP/1.1
User-Agent: OutSystemsPlatform
Content-Type: multipart/form-data; boundary="<my boundary>"
Authorization: Bearer <my bearer>
Host: app.asana.com
Content-Length: 218

--<my boundary>
content-disposition:  multipart/form-data; name=file; filename=<my filename>;
content-type: image/jpeg
<file binary data>
--<my boundary>--

我得到的答复如下

HTTP/1.1 504 Gateway Time-out
Connection: keep-alive
Content-Length: 176
Content-Type: text/html
Date: Tue, 28 Apr 2015 11:36:03 GMT
Server: nginx

<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>

我觉得请求格式正确,但不起作用。

任何人都可以提供帮助吗?

由于 佩德罗卡多佐

1 个答案:

答案 0 :(得分:0)

好问题!不幸的是,由于在解析服务器上发生的数据期间抛出错误,多部分/表单数据上传很容易产生5xx。

我们正在努力加强这一点并尽可能地返回4xx。

我怀疑您因线路终止不当而收到此错误。

请求应遵循HTTP / 1.1规范,行终止符的格式为CRLF\r\n 概述here以便服务器 以可靠和妥善处理请求。