我不知道您是如何发出 API 请求的(使用什么工具或编程语言),但 API 密钥和用户名应放在 HTTP 标头中。
以下是来自 Discourse REST API Documentation 的 curl 示例:
curl -X POST "http://127.0.0.1:3000/categories" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: 714552c6148e1617aeab526d0606184b94a80ec048fc09894ff1a72b740c5f19" \
-H "Api-Username: discourse1" \
-F "name=89853c20-4409-e91a-a8ea-f6cdff96aaaa" \
-F "color=49d9e9" \
-F "text_color=f0fcfd"