Bug #22326
closedAPI gives subtotal=0 when per_page=0 and thin=true and search string is used
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"}]