-1

Is there a way to filter users returned by /users/ endpoint to get users with some "location" value only?
If so, in order to correctly filter locations like "New York, United States" by "United States", can "users" be filtered by "location" that contains some string as a substring?

Is there a documentation describing what fields of the "user" object could be used for filtering and how (if any)?

rene
  • 41,474
  • 78
  • 114
  • 152
BUKTOP
  • 867
  • 10
  • 22

1 Answers1

1

No, you can't query the /Users endpoint with a location.

The only available query parameters are documented here and are limited to:

  • min,
  • max,
  • fromdate,
  • todate, and
  • inname

inname operates on the userdisplayname. There is no inlocation parameter so you're out of luck. The only option left is fetch all users and then filter locally but fetching all users is hardly viable.

An alternative might be using the Stack Exchange Data Explorer or Stack Exchange Datadump.

A similar question has been asked before on Stack Apps: Can I fetch Stack Overflow users by location in Stack Exchange API

rene
  • 41,474
  • 78
  • 114
  • 152
  • Understood, thank you. I supposed so as I read the same document you have quoted, but still had a hope I just missed something. Well, the problem is, that throttling is quite heavy, like, I use one request per second (!!!) and still have gotten 502 after, like 30-40 requests. So, now I cannot imagine a usecase this endpoint will be usable for. – BUKTOP Feb 05 '23 at 14:45
  • Aand thank you for StackApp site - didn't know it even exists! – BUKTOP Feb 05 '23 at 14:47
  • 1
    @BbIKTOP there is also guidance on throttling, like for example https://stackapps.com/questions/7255/got-502-response-after-very-few-calls/7692#7692 and https://stackapps.com/questions/9224/whats-the-relation-between-access-token-key-quota-max-and-throttling/9225#9225 and https://meta.stackexchange.com/questions/243773 – rene Feb 05 '23 at 15:00
  • Wow. I've seen the first one, but second is very useful, didn't know about "backoff", will try it, thank you again! – BUKTOP Feb 05 '23 at 15:29