Issue with ZendeskApi_v2 library in retrieving the top 10 search results | Community
Skip to main content

Issue with ZendeskApi_v2 library in retrieving the top 10 search results

  • August 26, 2023
  • 1 reply
  • 0 views

I'm using the ZendeskApi_v2 library to interact with the Zendesk API and retrieve tickets for a specific user. I've encountered an issue while trying to fetch only the top 10 results from the search, and it seems that the limit or per_page parameters are not behaving as expected.

I have tried using both limit and per_page in my search query, but it either returns a small number of outdated records or none at all. Without these parameters. I can get a complete list of results, but I'm struggling to limit the results to only the top 10.

Here's a simplified version of my code:

private void SearchTickets(string submitter, int limit = 10)
{    
    string searchTerm = $"submitter:{submitter} order_by:created sort:desc";    

    // How can I properly limit the results to the top 10?
    string limitedSearchTerm = $"{searchTerm} limit:{limit}";
    var results = _api.Search.SearchFor<Ticket>(limitedSearchTerm);

    Console.WriteLine(results.Count);    
}

1 reply

Hi WasiKara,
 
It's not clear whether that library supports doing so.  I recommend opening a question on the repo's discussions for more info on whether the developer supports specifying the page size of results.