Amending the order of lists

Ordering of results is based on the “order” parameter. The value for this parameter can be a single entity or comma separated list of entities to order by. Note that if you order by a field that is not unique (for example, by host group for a list of hosts), then the order is not determinate - it would be better to order by a secondary field that is unique (for example, by host group name then by host id).

Ordering will be performed in order from left to right. For example, to order the results by hosts with SNMP enabled then name, the order should be “snmp_enabled,name”.

The default order is ascending, but can be changed to descending by appending the criterion with “_desc”. For example, to reverse order by name, “order=name_desc”.

It is possible to order by sub-entity, ie. entities that don't have a straight value, such as enable_snmp, name, ip, but rather entities that have multiple values: hostgroup, hosttemplates, servicechecks, etc. To do this, the criterion must be the name of that value, followed by a fullstop, then the entity to order by. For example, to order the hosts by host group name, order should be “hostgroup.name”.