sort API Parameter

The sort parameter provides a way to sort API results by one or more attribute values. 

Simple example:

{{'template-name').sort('itemName', 'asc') }}

The first argument to the sort parameter is the layout key for the attribute to sort by. The second argument is the direction to sort by.

Allowed sort direction values are: 'asc' or 'desc'.

If you need to sort by multiple attributes then you can use the sort parameter multiple times. Each sort parameter can have a different sort direction if desired.

{{'template-name').sort('itemName', 'asc').sort('color', 'desc') }}

Alternately you could use one sort parameter and pass a hash value instead. The keys would be the attribute layout keys and the values would be the sort direction.

{{'template-name').sort({'itemName': 'asc'}) }}

{{'template-name').sort({'itemName': 'asc', 'color': 'desc'}) }}