Search for users by email domain

I’m writing code for a feature that allows us to change the email domain for all users given old and new domain names.
So I would need to search the directory for all users having the old email domain.
If I do a search like:
/api/v1/users?search=profile.email+sw+%22test%22
I get all users whose email starts with ‘test’
But if I search with endsWith:
/api/v1/users?search=profile.email+ew+%22example.com%22
I get this error:

{
  "errorCode": "E0000031",
  "errorSummary": "Invalid search criteria.",
  "errorLink": "E0000031",
  "errorId": "oaeBre_Q4s6SHWeKFK6WCo4Og",
  "errorCauses": [
    {
      "errorSummary": "Invalid search syntax."
    }
  ]
}

I expect that the directory will eventually be quite large, so I don’t want to pull all users.
How can I search users by email domain?

Hello,

ew is only available for the System Log API

1 Like

Thanks Erik,

That explains the error. But I still need to find how to do the domain query.

Diana