Skip to main content

Sorting Parameters (orderby and sortdirection)

The sorting parameters are used to adjust the order in which cards are returned to you in a response. You are able to specify which column you want the order to sort by, and in which direcrtion it should sort them in (Ascending/Descending). For example, you could sort the response by the ink cost of the cards in descending order.

Syntax: orderby=<column name>&sortdirection=<ASC or DESC>

Usage

Ordering your response has two seperate parameters, one is required and one is optional. The first parameter is the orderby parameter, this parameter dictates which column it should base the sort off of. If the column is a numeric field, it will sort numerically, if the column is a string field, it will sort alphanumerically.

Example:

api.lorcana-api.com/cards/all?orderby=cost

This example would return to you the top 1000 cards that are sorted by ink cost starting from the lowest ink cost to the highest. If you wante to sort from highest to lowest, you will have to use the sortdirection parameter.

The sortdirectionparameter dictates whether the sort should be in ascending or descending order. Ascending means lowest value first, while descending means highest value first. Because of this, the only two valid options for this parameter are ascending and descending or asc/desc for short.

Example:

api.lorcana-api.com/cards/all?orderby=cost&sortdirection=desc

This example would now return the top 1000 cards sorted by ink cost with the highest cost first.