Project

General

Profile

Bug #25487

'subtotal' is incorrect in API responses

Added by John Mitsch 2 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
High
Assignee:
Category:
API
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

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 about 1 month 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 2 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6254 added

#2 Updated by Tomer Brisker 2 months ago

  • Found in Releases 1.18.2, 1.19.0 added

#3 Updated by Tomer Brisker 2 months ago

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

#4 Updated by Tomer Brisker about 2 months ago

  • Target version set to 1.20.1

#5 Updated by The Foreman Bot about 1 month ago

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

#6 Updated by John Mitsch about 1 month ago

  • Status changed from Ready For Testing to Closed

#7 Updated by Marek Hulán about 1 month ago

  • Fixed in Releases 1.20.1 added

#8 Updated by Tomer Brisker about 1 month ago

  • Fixed in Releases 1.21.0 added

#9 Updated by John Mitsch about 1 month ago

  • Bugzilla link set to 1642549

Also available in: Atom PDF