Project

General

Profile

Actions

Bug #22326

closed

API gives subtotal=0 when per_page=0 and thin=true and search string is used

Added by Marek Hulán over 6 years ago. Updated over 5 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1516929

Description of problem:
API gives subtotal=0 when per_page=0 and search string is used

Version-Release number of selected component (if applicable):
6.2.11

How reproducible:
Everytime

Steps to Reproduce:
1. Install sat6 server
2. Define two hosts test1 & test2
3. run curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&thin=true&search=name+~+"test"

Actual results: {
"total": 3,
"subtotal": 0, <==============
"page": 1,
"per_page": 0,
"search": "name ~ \"test\"",
"sort": {
"by": null,
"order": null
},
"results": []
}

Expected results: {
"total": 3,
"subtotal": 2, <==============
"page": 1,
"per_page": 0,
"search": "name ~ \"test\"",
"sort": {
"by": null,
"order": null
},
"results": []
}

Additional info:
Different combinations give correct "subtotal":

without thin=true:

curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&search=name+~+"test"' {
"total": 3,
"subtotal": 2,
"page": 1,
"per_page": 0,
"search": "name ~ \"test\"",
"sort": {
"by": null,
"order": null
},
"results": []
}

without search:
curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?per_page=0&thin=true' {
"total": 3,
"subtotal": 3,
"page": 1,
"per_page": 0,
"search": null,
"sort": {
"by": null,
"order": null
},
"results": []
}

without per_page:
curl -u admin:xxx -X GET 'https://sat6/api/v2/hosts?thin=true&search=name+~+"test"' {
"total": 3,
"subtotal": 2,
"page": 1,
"per_page": 20,
"search": "name ~ \"test\"",
"sort": {
"by": null,
"order": null
},
"results": [{"id":2,"name":"test1"},{"id":3,"name":"test2"}]


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #23599: Getting hosts via API with thin=true returns wrong subtotal valueClosedAmir Fefer05/15/2018Actions
Actions

Also available in: Atom PDF