Description of problem: I previously used the rest-api endpoint "/katello/api/v2/environments" with sort_by=id. It works with 6.4 and 6.3. After the upgrade to 6.5 i noticed i was not getting the lifecycle environmens list. After some diagnosis i noticed that the endpoint changed behaviour. I use the endpoint in a ruby script that i wrote, but i put regular CURLs on the bugreport. Was "sort_by=id" removed? Version-Release number of selected component (if applicable): 6.5.0 How reproducible: always Steps to Reproduce: This used to work for Sat 6.4 and 6.3, it does not work with Sat 6.5 $ curl -k -u admin:redhat01 -X GET https://sixthsat2.example.com/katello/api/v2/environments?page=1\&sort_by=id\&per_page=10\&sort_order=ASC {"total":0,"subtotal":0,"page":null,"per_page":null,"error":"the field 'id' in the order statement is not valid field for search","search":null,"sort":{"by":"id","order":"ASC"},"results":[]} Actual results: This used to work for Sat 6.4 and 6.3, it does not work with Sat 6.5 $ curl -k -u admin:redhat01 -X GET https://sixthsat2.example.com/katello/api/v2/environments?page=1\&sort_by=id\&per_page=10\&sort_order=ASC {"total":0,"subtotal":0,"page":null,"per_page":null,"error":"the field 'id' in the order statement is not valid field for search","search":null,"sort":{"by":"id","order":"ASC"},"results":[]} Expected results: Workarounds: a) remove sorting: $ curl -k -u admin:redhat01 -X GET https://sixthsat2.example.com/katello/api/v2/environments?page=1\&per_page=10\&sort_order=ASC b) sory by name instead. (But sorting by name does work. I no longer have a Sat 6.4 to test ATM.) $ curl -k -u admin:redhat01 -X GET https://sixthsat2.example.com/katello/api/v2/environments?page=1\&sort_by=name\&per_page=10\&sort_order=ASC Additional info: I re-checked the apidoc but i found no help on "valid" sort_by values. So i cannot know if this is intentional or just a bug. On the APIDOC: sort_by -> optional "Field to sort the results on" Validations: String And no more info.
Verified fix in Sat 6.7 snap 4. 1. Created a number of lifecycle environments 2. curl -k -u admin:password -X GET "https://satellite.example.com/katello/api/v2/environments?page=1&sort_by=id&per_page=10&sort_order=ASC" The result was all the lifecycle environments, sorted by id. Also tried it with out sort_by and got a (seemingly) random order.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:1454