I am using the Zendesk official API for rails which is here: https://github.com/zendesk/zendesk_api_client_rb
When I try this query it keeps coming back with a stack level too deep error for the render json line.
def ticket_search
client = connection
search_tickets = client.search('type:ticket status:open')
render(json: search_tickets)
end
However, when I try:
mycompany.zendesk.com/api/v2/search.json?query=type:ticket% status:open assignee:none
It successfully returns the JSON. Is there a way to see how it is constructing the query or is my formatting wrong? I also tried lots of variantions with and without the quotes, single quotes, double quotes etc
This does not work either:
search_tickets = client.search(:query => 'type:ticket status:open')
fwiw I can get the find method below working fine but that only returns one ticket, I need all tickets
def ticket_get
ticket_id = params[:id]
client = connection
ticket = client.tickets.find!(id: ticket_id)
render(json: ticket)
end
The solution was to add fetch to the end of the query.
search_tickets = client.search(:query => 'type:ticket status:open').fetch