Search via api for exact match only?
-
I am working on using the API to search for a user by email and then getting the ID of the user and then executing a change to the account based on the ID. The only issue is, it seems that when I search, the search doesn’t require it to be exact. I am wanting it to be exact.
Example is, I search for a user using:
"GET /wp-json/wp/v2/[email protected] HTTP/1.1" 200
It comes back with the correct user, but if I also tried:"GET /wp-json/wp/v2/users?search=username@gmai HTTP/1.1" 200
That also came back with the user. I am developing just using a test site so I only have a few users, but I foresee that this could be a problem. I am needing to search for one specific user by email at a time and I was hoping that when I got a result back I could validate it by checking if the email address shown in the json search result matched the email that was passed to it, but it doesn’t look like it displays the email address in the results either.Does anyone have any suggestions on what I can do to get things a bit closer to what I am after?
- The topic ‘Search via api for exact match only?’ is closed to new replies.