Unable to use the 'email' field in a WHERE clause when using LiQL against the users table
I am trying to figure out how I can retrieve the User ID or login (i.e. username) for a user when I only have their email address using LiQL, but for some reason I am getting an "Invalid query syntax" error in all of my attempts.
Below is the JSON returned when querying using Python.
{'status': 'error', 'message': 'Invalid query syntax', 'data': {'type': 'error_data', 'code': 604, 'developer_message': "'email' is not a valid constraint for the object 'users'. in: SELECT login FROM users WHERE email = 'admin@lithium.com'", 'more_info': ''}, 'metadata': {}}
Below is a screenshot from the API Browser in Studio.
Does anyone have any idea what I'm doing wrong? I've tried all sorts of adjustments and email addresses (even using LIKE, MATCHES, etc.) but no dice.
Thanks!
Jeff
Hi jeffshurtliff
It seems that the where clause constraint you are trying to use is not available.
However as an alternate you can use the v1 API call to fetch user from email. Please find below:
[yourcommunityurl]/restapi/vc/search/users?q=email:[email id]
Please let me know if this was helpful.
Thanks