Reputation: 6372
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:
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
Reputation: 31
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
Reputation: 161
Its simple, just do:
https://mydomain.zendesk.com/api/v2/users/search.json?query=email:[email protected]
Hope it helps.
Upvotes: 12
Reputation: 171
This is how to do it with the Zendesk PHP API Client Library:
$client->users()->search(array("query"=>"[email protected]"));
Upvotes: 2
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
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