wwwuser
wwwuser

Reputation: 6372

Zendesk find user by email

How do you search to see if a user exists in Zendesk?

I've tried the following, where mydomain is the domain of my company:

https://mydomain.zendesk.com/api/v2/users/[email protected]

This is documented in their API:

http://developer.zendesk.com/documentation/rest_api/users.html#search-users

However, I am getting an HTTP 404 error as the response:

{"error": "InvalidEndpoint", "description": "Not found"} 

Upvotes: 5

Views: 7297

Answers (5)

https://mydomain.zendesk.com/api/v2/users/search.json?query=email:[email protected]

In case email consist special chars ([email protected]) it wont work. But urlencode can help.

Upvotes: 3

martinmakesitwork
martinmakesitwork

Reputation: 161

Its simple, just do:

https://mydomain.zendesk.com/api/v2/users/search.json?query=email:[email protected]

Hope it helps.

Upvotes: 12

j0ris
j0ris

Reputation: 171

This is how to do it with the Zendesk PHP API Client Library:

$client->users()->search(array("query"=>"[email protected]"));

Upvotes: 2

Nasir Hussain
Nasir Hussain

Reputation: 31

Though a v late response but might be helpful for someone in future.

Please make sure that you make proper use of POST, PUT and GET accordingly. I got an error

Array([error] => InvalidEndpoint, [description] => Not found)

while coding which was because I was using POST instead of GET while searching user in Zendesk using API.

Here is a v helpful article too on adding/updating users to Zendesk Zendesk API Implementation In Codeigniter

Upvotes: 0

Kate
Kate

Reputation: 61

We've put together a useful nuget package if you're working with C#.

You can use the package to create a ZendeskApiClient:

IZendeskClient client = new ZendeskClient(
    new Uri("my-zendesk-api-host-endpoint"),
    "my-zendesk-username",
    "my-zendesk-token"
);

Then you can use the Search resource to find users:

var response = client.Search.Find(new ZendeskQuery<User>().WithCustomFilter("email", "usersEmail"));

Have a look at our blog for more detail.

Upvotes: 3

Related Questions