Project

General

Profile

Bug #25487

'subtotal' is incorrect in API responses

Added by John Mitsch about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
No
Bugzilla link:

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

Related to Foreman - Bug #24712: Foreman (1.18?) slow API call against fact_values endpointClosed

Associated revisions

Revision 660e9794 (diff)
Added by John Mitsch almost 2 years ago

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.

History

#1 Updated by The Foreman Bot about 2 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 about 2 years ago

  • Found in Releases 1.18.2, 1.19.0 added

#3 Updated by Tomer Brisker about 2 years ago

  • Related to Bug #24712: Foreman (1.18?) slow API call against fact_values endpoint added

#4 Updated by Tomer Brisker almost 2 years ago

  • Target version set to 1.20.1

#5 Updated by The Foreman Bot almost 2 years ago

  • Pull request https://github.com/theforeman/foreman/pull/6299 added

#6 Updated by John Mitsch almost 2 years ago

  • Status changed from Ready For Testing to Closed

#7 Updated by Marek Hulán almost 2 years ago

  • Fixed in Releases 1.20.1 added

#8 Updated by Tomer Brisker almost 2 years ago

  • Fixed in Releases 1.21.0 added

#9 Updated by John Mitsch almost 2 years ago

  • Bugzilla link set to 1642549

Also available in: Atom PDF