Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Is search supported? #54

pehrlich opened this Issue · 9 comments

4 participants


From what I can figure out, it looks like methods correspond to URLs, with some intelligence/guessing:

# the query option is silently dropped
# maybe?
> $zendesk.ticket(query: 'moon').first

# typos are passed to ZenDesk API
> $zendesk.tickts(query: 'moon').first
the server responded with status 404
{"error"=>"InvalidEndpoint", "description"=>"Not found"}

# notice that user becomes users:
 > $zendesk.user(query: 'moon').count

$ 'moon').first
NoMethodError: undefined method `superclass' for ZendeskAPI::Search:Module

How would I run a search, such as the following (which is a valid call)?

# simple
curl "" -v -u email:pasword
# typed:
 curl "" -v -u email:pasword

Edit: #29 suggests => email). How would I find this user's tickets?



Your last call is correct, though there was a bug in the client and it should be fixed in master. There should be a new release within a couple days. Doing $ 'type:moon').first will then work.

You may also search tickets by requester, assignee, etc. See However, if you already have a user instance, you can just call User#tickets.


Just released a new version, 0.1.7 that should fix your problem. Thanks!

@steved steved closed this
@steved steved reopened this

Yay, it works!

But if I change the parameters, the query doesn't get run again. I think this is a known issue?

Is there a workaround to clear the cache?



To clear the cache, use the :reload option => 'new query', :reload => true)

I'll add in an option to do something like, if it's preferable:

search = => 'query')
search.fetch # => returns results for /api/v2/search?query=query
search.options[:query] = 'new_query'
search.fetch(true) # => returns results for /api/v2/search?query=new_query

Thinking about it, a the client cache should probably be based on the parameters passed in as well.


Added to the master (240f3aa)

@steved steved closed this

Is this the only place that search is documented? I could not find any mention of it in the README or in the rdoc.


I guess, unfortunately, it is. I'll add it the README and look into expanding the ZendeskAPI::Client rdoc.


Man I am struggling with the Zendesk API search feature. I don't mind the Zendesk documentation API on the website but it is all curl based and I'd like it to be ruby. I'll raise a seperate issue for the particular searches I am trying to do, just simple things like I guess just trying to reiterate benilovj's point from two years ago that it would be nice to expand the rdoc... :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.