管理员报告数据的API

我希望从 HTTP API 访问管理员报告数据。

这篇帖子似乎表明类似这样的内容会起作用:
/admin/reports/posts.json

我现在收到 404 错误。

所有类似这样的 URL 似乎都不起作用。/admin/reports/staff_logins.json

我可以从Discourse API 文档正常运行 API 命令。

我的主要目标是获取此报告:

/admin/reports/user_notes.json

我正在使用 GET 方法,并附带管理员账户的 Api-Key 和 Api_Username。

您能否分享一下您当前正在发出的请求的 cURL?

感谢您的帮助。这是我正在使用的 curl 脚本

curl --request GET \
  --url https://community.domain.com/admin/reports/staff_logins.json \
  --header '"Api-Key": "stringForAPIKey"' \
  --header '"Api-Username": "stringForUsername"' \
  --header '"Content-Type": "application/json"'

我收到 404 错误

您能否给我一个在您的系统上可用的 curl 脚本?

我正在使用 Discourse 2.9.0.beta10

用户是管理员。
API 密钥适用于 Discourse API Documentation 网站上列出的其他 API 命令。

再次感谢。

1 个赞

我在 Meta 上用以下命令进行了一个测试:

curl https://meta.discourse.org/admin/reports/staff_logins.json \
  -H 'Api-Key: asdasdasdasd' \
  -H 'Api-Username: Falco'

对我来说运行得很好。你能像这样试试吗?

3 个赞

@Falco 哇。你是真牛。这解决了我的问题。

我问题的根源是我正在使用一个叫做 Insomnia 的工具来测试 API,而且我对 Insomnia 经验不多。

感谢你的帮助。我被困了一周,非常感激你的协助。这也解决了我在 user_notes 报告方面遇到的另一个问题。

2 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.