我正在开发一个由 Discourse 驱动的论坛。在管理员向我提供了 API 密钥和用户名后,我发现 POST /posts.json API 端点存在一个 bug。
正如此处所述,该端点接受一个 topic_id,其类型应为整数。但是,当我使用 topic_id 和 raw 参数发起请求,例如:
{
"topic_id": 17470,
"raw": "Test post."
}
我会收到以下错误:
'You are not permitted to view the requested resource. The API username or key is invalid.'
然而,当我将请求数据修改为将 topic_id 作为字符串后,就能成功创建帖子:
{
"topic_id": "17470",
"raw": "Test post."
}