4

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);    
}
ilCosmico
  • 1,319
  • 15
  • 26

0 Answers0