# Admin/users/list/ REST API not working

**URL:** https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442
**Category:** Development
**Tags:** rest-api
**Created:** [November 23, 2023, 2:21pm UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442 "2023-11-23T14:21:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lenny1](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@lenny1](https://meta.discourse.org/u/lenny1)
#### Post date: [November 23, 2023, 2:21pm UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/1 "2023-11-23T14:21:40Z")

</div>

I tried to get active users but it returned error message **“The requested URL or resource could not be found”.**  
My java codes:

```plaintext
	
	     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](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](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

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [November 23, 2023, 2:38pm UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/2 "2023-11-23T14:38:07Z")

</div>

Hi,

What `User Level` and `Scope` did you use for that API key?

If you are sure there is no typo, you might have created one with a non-admin single user.

---

<div class="post-metadata">

### Author: ![lenny1](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@lenny1](https://meta.discourse.org/u/lenny1)
#### Post date: [November 24, 2023, 4:07am UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/3 "2023-11-24T04:07:49Z")

</div>

Single User, Global. Yes. non-admin  
So the user must be a adminstrator?  
I tried “All Users”, Global also has same issue.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [November 24, 2023, 9:22am UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/4 "2023-11-24T09:22:05Z")

</div>

To access the admin areas, you would need an API key with admin permissions. 👍

---

<div class="post-metadata">

### Author: ![lenny1](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@lenny1](https://meta.discourse.org/u/lenny1)
#### Post date: [November 24, 2023, 2:39pm UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/5 "2023-11-24T14:39:38Z")

</div>

> [@post:1](#):
>
> The requested URL or resource could not be found

IMO, the error message is misleading. It should be more meaningful about the permission such as “Invalid credential”.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 24, 2023, 2:39pm UTC](https://meta.discourse.org/t/admin-users-list-rest-api-not-working/286442/6 "2023-12-24T14:39:54Z")

</div>

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