创建Todo列表时Basecamp 3 API 400错误

时间:2016-11-18 21:11:50

标签: basecamp

暂时排除故障并且无法得出答案。我运行get命令没有问题所以列出basecamps,todos,accounts等等。所有这些工作正常。当我向todolists.json发帖时,我遇到了问题。

我发送到此网址:

https://3.basecampapi.com/3266090/buckets/1940710/todosets/296431359/todolists.json

接头:

[0] => Content-Type: application/json; charset=utf-8
[1] => User-Agent: Template Deployer (s****d@***.org)
[2] => Authorization: Bearer [working token]
[3] => If-None-Match: 

POST有效负载:

name=foobar

以下是我得到的回复:

[result] => Array
    (
        [status] => 400
        [error] => Bad Request
    )

[headers] => Array
    (
        [Server] => nginx
        [Date] => Fri, 18 Nov 2016 21:05:44 GMT
        [Content-Type] => application/json; charset=utf-8
        [Content-Length] => 36
        [Connection] => keep-alive
        [X-Request-Id] => ab71cfaa-e24c-4a38-b1af-44fe8ae8d147
        [X-Runtime] => 0.456205
        [Strict-Transport-Security] => max-age=15552000; includeSubDomains; preload
        [X-Queue-Time] => 0.0010805130004882812
        [Set-Cookie] => force-primary-dc=true;Max-Age=5;Path=/;Version=1;
    )

[code] => 400
[content_type] => application/json; charset=utf-8

我尝试了几个名称,描述和项目的组合(来自我发现的另一个关于别人的问题的线索),但无济于事。我甚至不知道还有什么可以尝试。

任何想法?

1 个答案:

答案 0 :(得分:0)

这是因为我不是一个聪明的人:)

答案:有效负载需要进行json编码:{"content":"Do this!"}而不是url编码:name=foobar

解决了问题!