Recent searches


No recent searches

Using search api to find end user details (using emaiid as query parameter)



Posted Jan 06, 2022

Hi Team,

We are trying to search user in zendesk system using user email through Zendesk API.

The curl command for the search API is as bellow:

curl "https://MYDOMAIN.zendesk.com/api/v2/search.json" \
-G --data-urlencode "query=email:XXXX@MYDOMAIN.com" \
-v -u steve@MYDOMAIN.com/token:----some-----secret-token---here

This sometimes gives result for some of the emails but not for some other emails.

Example emails which exists in zendesk but does not give any result when searched using above curl command:

user+1@mydomain.com (does not work)

user+3@mydomain.com (works)

user@mydomain.com (does not work)

Can someone suggest what are we missing in the curl command ?


1

15

15 comments

image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Chandrajyoti Das,

Thanks for reaching out!

First thing I'd suggest trying is adding the type keyword to explicitly declare that you're wanting to search for users:

"query=type:user email:XXXX@MYDOMAIN.com"

Let me know if this helps!

Tipene

0


Hi Tipene,
I tried as per your suggestion, but result is same...
Is there any other way?

0


Also I tried bellow query :

curl https://banknovo.zendesk.com/api/v2/search.json?query=“Chandra*” -v -u steve@MYDOMAIN.com/token:----some-----secret-token---here

This also didn’t give results.

So can I get some other solution on this?

0


Hi Tipene Hughes,
Any update on this? 

0


image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Chandrajyoti Das,

Sorry for the delay in getting back to you!

Can you try URL encoding any special characters in the local-part of the email address i.e user%2B1@mydomain.com in place of user+1@mydomain.com. Also, the wildcard operator does not work for email hence why you would have received no responses for query="Chandra*. 

Let me know if this helps!

Tipene 

0


Tipene Hughes,
I tried your suggestion but its same result...
We are looking for this api very desperately, as we have to implement some customer related functionalities.

But this has been a blocker for a long time...

We want to merge 2 users in zendesk, after searching & checking a redundant email of our user. Any help on this will be a great help...

0


image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Chandrajyoti Das,

So I can look in to this in a bit more detail, I'm going to pull this in to a private ticket. You should see an email from me shortly.

Thanks!

Tipene

0


Hi Team,

Tipene Hughes I have been facing the same issue, may i know a way around it?

0


Tipene Hughes - Can you please suggest what are the next steps here. Here is our use case:

If a user changes the email in our system, and the new email already exists in Zendesk, we would like to merge the two emails in zendesk so that users can have access to their historical chat information. 

This is to make sure both the emails are tied to the same external id. We hear a lot of complaints from the user for support tab broken on using zendesk widget. 

Please see who can help in this matter

 

0


image avatar

Christopher Kennedy

Zendesk Developer Advocacy

Hi Neha,
 
You can merge the user with the "new email" into the existing user who has the external ID.  Do you use JWT auth for users in the widget?
 

0


Hi Christopher, can we get on a call to show you what exactly is happening here. Can you provide some time slots to me?

0


The main problem is we dont get results from the curl command. If we will get the results, we will be able to move forward.

 

The curl command for the search API is as bellow:

curl "https://MYDOMAIN.zendesk.com/api/v2/search.json" \
-G --data-urlencode "query=email:XXXX@MYDOMAIN.com" \
-v -u steve@MYDOMAIN.com/token:----some-----secret-token---here

This sometimes gives result for some of the emails but not for some other emails.

Example emails which exists in zendesk but does not give any result when searched using above curl command:

user+1@mydomain.com (does not work)

user+3@mydomain.com (works)

user@mydomain.com (does not work)

Can someone suggest what are we missing in the curl command ?

0


image avatar

Christopher Kennedy

Zendesk Developer Advocacy

Hi Neha,
 
I've created a ticket to work directly with you on this.  Look out for next steps in the ticket notification.

0


Hi, Christopher Kennedy I faced a similar issue. May I know what's the solution?

 Thanks!

0


Hello, it's me again 😄

If anyone is facing this issue, apparently you can solve this simply by escaping the email string, eg


safe_email_string = urllib.parse.quote_plus("your_email+12@example.com")

/api/v2/users/search.json?query=email:{safe_email_string}'
 

A better API documentation would be helpful for your customer, instead of us having to guess your API behavior randomly 😄

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post