I tried to get active users but it returned error message “The requested URL or resource could not be found”.
My java codes:
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();
I am certain that nothing wrong with my api key because it works for other query for instance “https://my-discourse-server/latest.json” returned the correct result.
Besides, If I login discourse as admin and type in url “https://my-discourse-server/admin/users/list/active.json” in the web browser it did list all the active users.
Whats wrong?
My discourse version is 3.1.0.beta2