Auth0 Home Blog Docs

User Search with multiple user_ids not working

management-api
user-id
search

#1

I’m trying to use the Auth0 management API to to query with multiple user_ids, and receive an array of users back. However, it’s not working.

I’m following the docs here: https://auth0.com/docs/api/management/v2#!/Users/get_users and here: https://auth0.com/docs/api/management/v2/user-search

This query works as expected, returning an array containing a single user: https://auth-dev.mozilla.auth0.com/api/v2/users?q=user_id:"<user_id_1>"&search_engine=v1

This query doesn’t, returning a ‘Something went wrong’ error: https://auth-dev.mozilla.auth0.com/api/v2/users?q=user_id:("<user_id_1>" OR "<user_id_2>")&search_engine=v1

What am I doing wrong?


#2

I have successfully managed to make a call for multiple user_id’s using search_engine: v2. Please try using v2 to see if it works.

https://auth-dev.mozilla.auth0.com/api/v2/users?q=user_id:("<user_id_1>" OR "<user_id_2>")&search_engine=v2

#3

I now realise the second query in my original post was returning a ‘Something went wrong’ error because I wasn’t url encoding the q parameter. When I do I only get an empty array back.

If I try to use v2:

{“statusCode”:400,“error”:“Bad Request”,“message”:“The ‘q’ parameter is available only if you specify ‘search_engine=v1’.”,“errorCode”:“invalid_query_string”}


#4

@prashant i suspect this is because this tenant is not the public cloud and does not support q= with v2 engine.


#5