Bug #25487
'subtotal' is incorrect in API responses
Pull request:
Description
When requesting an endpoint with a search parameter, the subtotal shows the results returned, rather than responses found.
i.e.
curl -k -u admin:changeme -H "Content-Type: application/json" 'localhost:3000/api/v2/hosts?search=%20os_major%20%3D%20%207'
{
"total": 72,
"subtotal": 20,
"page": 1,
"per_page": 20,
"search": " os_major = 7",
"sort": {
"by": null,
"order": null
},
...
The subtotal is 20, which is the results returned and not the actual number of results returned by the search query.
Related issues
Associated revisions
History
#1
Updated by The Foreman Bot over 3 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/6254 added
#2
Updated by Tomer Brisker over 3 years ago
- Found in Releases 1.18.2, 1.19.0 added
#3
Updated by Tomer Brisker over 3 years ago
- Related to Bug #24712: Foreman (1.18?) slow API call against fact_values endpoint added
#4
Updated by Tomer Brisker over 3 years ago
- Target version set to 1.20.1
#5
Updated by The Foreman Bot over 3 years ago
- Pull request https://github.com/theforeman/foreman/pull/6299 added
#6
Updated by John Mitsch over 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 660e9794af46b3f614b54fe0f2c9375a169f3613.
#7
Updated by Marek Hulán over 3 years ago
- Fixed in Releases 1.20.1 added
#8
Updated by Tomer Brisker over 3 years ago
- Fixed in Releases 1.21.0 added
#9
Updated by John Mitsch over 3 years ago
- Bugzilla link set to 1642549
Fixes #25487 - Fix subtotal in API response
When requesting an endpoint with a search parameter, the subtotal
shows the results returned, rather than responses found. i.e. even
if 200 results were found, if 20 are being returned because of
pagination, the subtotal will be 20.
This changes back to using `count`, which sends another SQL query
and returns the correct subtotal.