我尝试获取活跃用户,但返回了错误消息 “找不到请求的 URL 或资源”。
我的 Java 代码:
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Api-Key", apiKey);
headers.put("Api-Username", userName);
headers.put("Accept", "application/json");
return Unirest.get("https://my-discourse-server/admin/users/list/active.json")
.headers(headers)
.asString()
.getBody()
.toString();
我确信我的 API 密钥没有问题,因为它适用于其他查询,例如“https://my-discourse-server/latest.json”返回了正确的结果。
此外,如果我以管理员身份登录 discourse 并在浏览器中输入 URL “https://my-discourse-server/admin/users/list/active.json”,它确实列出了所有活跃用户。
有什么问题?
我的 discourse 版本是 3.1.0.beta2