Ordering and Sorting

The following URL is an example query that lists all users available on an Oracle Linux Automation Manager server:

http://<hostname or IP address>/api/v2/users/

In the previous example, <hostname or IP address> is the IP address of your Oracle Linux Automation Manager.

To specify that entities that return more than one result set are returned in a particular order, you can use GET requests with the order_by parameter. For example,

http://hostname or IP address/api/v2/<multi_result_entity>/order_by=<order_field>

In the previous example, <multi_result_entity> is an entity that includes more than one result set, such as, for example, where there are more than one user instance for the users entity. <order_field> is the name of the field to order the results by.

You can use the prefix the field name with a dash (-) to sort in reverse. For example,

http://hostname or IP address/api/v2/<multi_result_entity>/order_by=-<order_field>

Specify multiple sorting fields using a comma (,) to separating each field names. For example,

http://hostname or IP address/api/v2/<multi_result_entity>/order_by=<order_field>,<other_order_field>

In the previous example, <other_order_field> is another field to include when sorting results.