Did this API endpoint break?

api

(Joshua Frank) #1

I’ve been using:

/admin/users/list/all.json?api_key={mykey}&api_username={myuser}&filter={some_address}

to look up users by email, and this worked fine for about a year. But recently it started returning an empty array, even when the Discourse app itself returns valid search results. I know the standard advice is to sniff the traffic to see what I need to pass the API, but I’m puzzled about that too, because the app does this:

/admin/users/list/all.json?filter={some_address}&show_emails=false

and passes authentication info in cookies (called _forum_session and _t).

So why would the app’s call be working and my API call not be working, and how can I fix this?


(Robin Ward) #2

I just tried this api call myself on the latest discourse and it worked fine. I used the first version you posted with my email address against meta and got back myself as a result. There might be something else not working the way you expect?


(Joshua Frank) #3

I finally tracked this down; I was url encoding my api call, so that the @ sign in the email address was being encoded and not matching the @ sign in the server side filter comparison. This was a bug on my end, not the API’s.


(Robin Ward) #4