Skip to content

Commit 8df535c

Browse files
authored
Fixes #673 - Added 'with_total_count' parameter
1 parent bae42b7 commit 8df535c

File tree

1 file changed

+337
-2
lines changed

1 file changed

+337
-2
lines changed

api/intro.rst

Lines changed: 337 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,9 @@ may have to use pagination at some points.
493493
returned objects. You can't raise these limits.
494494

495495
**Number of total to return objects:** Zammad does not provide a total
496-
count of objects available for your query. This forces you to cycle
497-
through the pages until Zammad no longer returns further objects.
496+
count of objects available for your query, unless you explicitly request it.
497+
To include the amount of search results, use the ``with_total_count`` or
498+
``only_total_count`` parameter.
498499

499500
In order to use pagination you'll need two get options:
500501
``per_page`` and ``page``. Combine them like so to receive 5 results from
@@ -2311,6 +2312,340 @@ Search example
23112312
"total_count": 1
23122313
}
23132314
2315+
``With Total Count`` Parameter
2316+
Using this parameter will additionally output the amount of search results.
2317+
It can be combined with ``full`` and ``expand``.
2318+
2319+
``GET``-Request sent: ``/api/v1/tickets/search?query=welcome&full=true&with_total_count=true``
2320+
2321+
.. code-block:: json
2322+
2323+
{
2324+
"record_ids": [
2325+
2,
2326+
1
2327+
],
2328+
"assets": {
2329+
"Ticket": {
2330+
"1": {
2331+
"id": 1,
2332+
"group_id": 1,
2333+
"priority_id": 2,
2334+
"state_id": 1,
2335+
"organization_id": 1,
2336+
"number": "97001",
2337+
"title": "Welcome to Zammad!",
2338+
"owner_id": 1,
2339+
"customer_id": 2,
2340+
"note": null,
2341+
"first_response_at": null,
2342+
"first_response_escalation_at": null,
2343+
"first_response_in_min": null,
2344+
"first_response_diff_in_min": null,
2345+
"close_at": null,
2346+
"close_escalation_at": null,
2347+
"close_in_min": null,
2348+
"close_diff_in_min": null,
2349+
"update_escalation_at": null,
2350+
"update_in_min": null,
2351+
"update_diff_in_min": null,
2352+
"last_close_at": null,
2353+
"last_contact_at": "2025-06-27T08:35:35.210Z",
2354+
"last_contact_agent_at": null,
2355+
"last_contact_customer_at": "2025-06-27T08:35:35.210Z",
2356+
"last_owner_update_at": null,
2357+
"create_article_type_id": 5,
2358+
"create_article_sender_id": 2,
2359+
"article_count": 1,
2360+
"escalation_at": null,
2361+
"pending_time": null,
2362+
"type": null,
2363+
"time_unit": null,
2364+
"preferences": {},
2365+
"updated_by_id": 2,
2366+
"created_by_id": 2,
2367+
"created_at": "2025-06-27T08:35:35.005Z",
2368+
"updated_at": "2025-06-27T08:35:35.306Z",
2369+
"checklist_id": null,
2370+
"referencing_checklist_ids": [],
2371+
"article_ids": [
2372+
1
2373+
],
2374+
"ticket_time_accounting_ids": [],
2375+
"ai_stored_result_ids": []
2376+
},
2377+
"2": {
2378+
"id": 2,
2379+
"group_id": 1,
2380+
"priority_id": 2,
2381+
"state_id": 2,
2382+
"organization_id": 1,
2383+
"number": "97002",
2384+
"title": "Welcome again",
2385+
"owner_id": 1,
2386+
"customer_id": 2,
2387+
"note": null,
2388+
"first_response_at": null,
2389+
"first_response_escalation_at": null,
2390+
"first_response_in_min": null,
2391+
"first_response_diff_in_min": null,
2392+
"close_at": null,
2393+
"close_escalation_at": null,
2394+
"close_in_min": null,
2395+
"close_diff_in_min": null,
2396+
"update_escalation_at": null,
2397+
"update_in_min": null,
2398+
"update_diff_in_min": null,
2399+
"last_close_at": null,
2400+
"last_contact_at": "2025-07-02T11:46:41.117Z",
2401+
"last_contact_agent_at": null,
2402+
"last_contact_customer_at": "2025-07-02T11:46:41.117Z",
2403+
"last_owner_update_at": null,
2404+
"create_article_type_id": 5,
2405+
"create_article_sender_id": 2,
2406+
"article_count": 1,
2407+
"escalation_at": null,
2408+
"pending_time": null,
2409+
"type": null,
2410+
"time_unit": null,
2411+
"preferences": {},
2412+
"updated_by_id": 3,
2413+
"created_by_id": 3,
2414+
"created_at": "2025-07-02T11:46:41.040Z",
2415+
"updated_at": "2025-07-02T11:46:41.210Z",
2416+
"checklist_id": null,
2417+
"referencing_checklist_ids": [],
2418+
"article_ids": [
2419+
2
2420+
],
2421+
"ticket_time_accounting_ids": [],
2422+
"ai_stored_result_ids": []
2423+
}
2424+
},
2425+
"Organization": {
2426+
"1": {
2427+
"id": 1,
2428+
"name": "Zammad Foundation",
2429+
"shared": true,
2430+
"domain": "",
2431+
"domain_assignment": false,
2432+
"active": true,
2433+
"vip": false,
2434+
"note": "",
2435+
"updated_by_id": 1,
2436+
"created_by_id": 1,
2437+
"created_at": "2025-06-27T08:35:34.797Z",
2438+
"updated_at": "2025-07-02T11:46:41.105Z",
2439+
"member_ids": [
2440+
2
2441+
],
2442+
"secondary_member_ids": []
2443+
}
2444+
},
2445+
"User": {
2446+
"1": {
2447+
"id": 1,
2448+
"organization_id": null,
2449+
"login": "-",
2450+
"firstname": "-",
2451+
"lastname": "",
2452+
"email": "",
2453+
"image": null,
2454+
"image_source": null,
2455+
"web": "",
2456+
"phone": "",
2457+
"fax": "",
2458+
"mobile": "",
2459+
"department": "",
2460+
"street": "",
2461+
"zip": "",
2462+
"city": "",
2463+
"country": "",
2464+
"address": "",
2465+
"vip": false,
2466+
"verified": false,
2467+
"active": false,
2468+
"note": "",
2469+
"last_login": null,
2470+
"source": null,
2471+
"login_failed": 0,
2472+
"out_of_office": false,
2473+
"out_of_office_start_at": null,
2474+
"out_of_office_end_at": null,
2475+
"out_of_office_replacement_id": null,
2476+
"preferences": {},
2477+
"updated_by_id": 1,
2478+
"created_by_id": 1,
2479+
"created_at": "2025-06-27T08:35:31.793Z",
2480+
"updated_at": "2025-06-27T08:35:31.793Z",
2481+
"role_ids": [],
2482+
"two_factor_preference_ids": [],
2483+
"organization_ids": [],
2484+
"authorization_ids": [],
2485+
"overview_sorting_ids": [],
2486+
"group_ids": {}
2487+
},
2488+
"2": {
2489+
"id": 2,
2490+
"organization_id": 1,
2491+
"login": "nicole.braun@zammad.org",
2492+
"firstname": "Nicole",
2493+
"lastname": "Braun",
2494+
"email": "nicole.braun@zammad.org",
2495+
"image": null,
2496+
"image_source": null,
2497+
"web": "",
2498+
"phone": "",
2499+
"fax": "",
2500+
"mobile": "",
2501+
"department": "",
2502+
"street": "",
2503+
"zip": "",
2504+
"city": "",
2505+
"country": "",
2506+
"address": "",
2507+
"vip": false,
2508+
"verified": false,
2509+
"active": true,
2510+
"note": "",
2511+
"last_login": null,
2512+
"source": null,
2513+
"login_failed": 0,
2514+
"out_of_office": false,
2515+
"out_of_office_start_at": null,
2516+
"out_of_office_end_at": null,
2517+
"out_of_office_replacement_id": null,
2518+
"preferences": {
2519+
"tickets_closed": 0,
2520+
"tickets_open": 2
2521+
},
2522+
"updated_by_id": 3,
2523+
"created_by_id": 1,
2524+
"created_at": "2025-06-27T08:35:34.872Z",
2525+
"updated_at": "2025-07-02T11:46:41.840Z",
2526+
"role_ids": [
2527+
3
2528+
],
2529+
"two_factor_preference_ids": [],
2530+
"organization_ids": [],
2531+
"authorization_ids": [],
2532+
"overview_sorting_ids": [],
2533+
"group_ids": {}
2534+
},
2535+
"3": {
2536+
"login_failed": 0,
2537+
"last_login": "2025-07-02T08:54:52.403Z",
2538+
"updated_by_id": 1,
2539+
"id": 3,
2540+
"organization_id": null,
2541+
"login": "admin@example.com",
2542+
"firstname": "Test",
2543+
"lastname": "Admin",
2544+
"email": "admin@example.com",
2545+
"image": null,
2546+
"image_source": null,
2547+
"web": "",
2548+
"phone": "",
2549+
"fax": "",
2550+
"mobile": "",
2551+
"department": null,
2552+
"street": "",
2553+
"zip": "",
2554+
"city": "",
2555+
"country": "",
2556+
"address": null,
2557+
"vip": false,
2558+
"verified": false,
2559+
"active": true,
2560+
"note": "",
2561+
"source": null,
2562+
"out_of_office": false,
2563+
"out_of_office_start_at": null,
2564+
"out_of_office_end_at": null,
2565+
"out_of_office_replacement_id": null,
2566+
"preferences": {
2567+
"notification_config": {
2568+
"matrix": {
2569+
"create": {
2570+
"criteria": {
2571+
"owned_by_me": true,
2572+
"owned_by_nobody": true,
2573+
"subscribed": true,
2574+
"no": false
2575+
},
2576+
"channel": {
2577+
"email": true,
2578+
"online": true
2579+
}
2580+
},
2581+
"update": {
2582+
"criteria": {
2583+
"owned_by_me": true,
2584+
"owned_by_nobody": true,
2585+
"subscribed": true,
2586+
"no": false
2587+
},
2588+
"channel": {
2589+
"email": true,
2590+
"online": true
2591+
}
2592+
},
2593+
"reminder_reached": {
2594+
"criteria": {
2595+
"owned_by_me": true,
2596+
"owned_by_nobody": false,
2597+
"subscribed": false,
2598+
"no": false
2599+
},
2600+
"channel": {
2601+
"email": true,
2602+
"online": true
2603+
}
2604+
},
2605+
"escalation": {
2606+
"criteria": {
2607+
"owned_by_me": true,
2608+
"owned_by_nobody": false,
2609+
"subscribed": false,
2610+
"no": false
2611+
},
2612+
"channel": {
2613+
"email": true,
2614+
"online": true
2615+
}
2616+
}
2617+
}
2618+
},
2619+
"locale": "en-us",
2620+
"intro": true,
2621+
"keyboard_shortcuts_clues": true,
2622+
"overviews_last_used": {
2623+
"1": "2025-06-27T09:27:26.333Z",
2624+
"5": "2025-06-27T09:27:28.222Z"
2625+
},
2626+
"theme": "light"
2627+
},
2628+
"created_by_id": 1,
2629+
"created_at": "2025-06-27T09:27:00.302Z",
2630+
"updated_at": "2025-07-02T08:54:52.433Z",
2631+
"role_ids": [
2632+
1,
2633+
2
2634+
],
2635+
"two_factor_preference_ids": [],
2636+
"organization_ids": [],
2637+
"authorization_ids": [],
2638+
"overview_sorting_ids": [],
2639+
"group_ids": {
2640+
"1": [
2641+
"full"
2642+
]
2643+
}
2644+
}
2645+
}
2646+
},
2647+
"total_count": 2
2648+
}
23142649
23152650
``Only Total Count`` Parameter
23162651
Using this parameter will output only the amount of search results.

0 commit comments

Comments
 (0)