Bug #18341
Updated by Tomáš Strachota about 6 years ago
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1138262 *Description of problem:* In the API the order option is working. The documented sort hash is not working. There are the undocumented sort_by and sort_order that are working instead. Not working sort hash: Working order: <pre> # curl -K /opt/hoici/etc/curl-admin.conf -H 'Content-Type: application/json' -d '{"per_page":"9999","sort":{"by":"name","order":"desc"}}' -XGET https://localhost/katello/api/v2/organizations/4/products | jq . | tail -n10 "sort": { "order": null, "by": null }, "search": null, "per_page": "9999", "page": 1, "subtotal": 19, "total": 19 } </pre> Working order: Not working sort hash: <pre> # curl -K /opt/hoici/etc/curl-admin.conf -H 'Content-Type: application/json' -d '{"per_page":"9999","order":"name desc"}' -XGET https://localhost/katello/api/v2/organizations/4/products | jq . | tail -n10 "sort": { "order": "desc", "by": "name" }, "search": null, "per_page": "9999", "page": 1, "subtotal": 19, "total": 19 } </pre> Working sort_by and sort_order: <pre> # curl -K /opt/hoici/etc/curl-admin.conf -H 'Content-Type: application/json' -d '{"per_page":"9999","sort_by":"name","sort_order":"desc"}' -XGET https://localhost/katello/api/v2/organizations/4/products | jq . | tail -n 10 "sort": { "order": "desc", "by": "name" }, "search": null, "per_page": "9999", "page": 1, "subtotal": 19, "total": 19 } </pre> *Expected results:* Consistent API functionality and documentation for sorting the results