Sorting Lst output

Any of the Lst endpoints, used to retrieve lists of specific inventory categories, supports requesting the output sorted by any of the columns in the output, to specify if the results need to be in ascending or descending order, and to restrict the number of items in the result set.

This ability was introduced in version 5.2.0 of the Revive Adserver REST API.

Specify column used for sorting

Description: Order the output by one of the columns in the output, instead of simply returning the data in the order coming from the database table.

Application: even though a client application might be perfectly capable of receiving all of the output and then applying the sort order internally, in some cases it makes sense to let the database server take care of ordering the output.

Implementation: URL/{category}/lst/?sort={column_name}

Default: if ‘?sort=’ is used, the output is returned by default in ascending order. See below for descending order.

Example:

For example, to sort the output of the list of known agencies by the agency ID:

Method: 
    GET http://api.example.com/agc/lst?sort=agencyId

Descending order

Description: If the output is sorted by one of the columns, an optional query parameter ‘desc’ can be used to specify that the sort order should be descending. Omitting the ‘desc’ parameter or specifying ‘desc=0’ (zero) will cause the output to be in ascending order.

Implementation: URL/{category}/lst/?sort={column_name}&desc=1

Example:

For example, to sort the output of known agencies by the agency ID, in descending order:

Method: 
    GET http://api.example.com/agc/lst?sort=agencyId&desc=1

Limit number of rows

Description: Instead of returning all available rows, an optional query parameter ‘limit’ can be used to return a specific number of rows.

Application: One application of the ‘limit’ parameter, in combination with the sort={} and desc=1 parameters, is to retrieve only the most recently created item of the category.

Implementation: URL/{category}/lst/?sort={column_name}&limit=1

Example:

For example, to retrieve only the most recently created agency:

Method: 
    GET http://api.example.com/agc/lst?sort=agencyId&desc=1&limit=1

Current version

The most recently released version of the Revive Adserver REST API is v5.2.0 (publication date April 18, 2024).

See Release Notes

Compatibility

Revive Adserver REST API is compatible with all versions of Revive Adserver v4.x, and v5.x. It may also be compatible with Revive Adserver v3.x (and also with OpenX Source v2.8 and higher), but this can not be guaranteed.

Revive Adserver REST API is compatible with all supported versions of PHP, including PHP 7 and PHP  8.

Also see Technical Requirements, Product Content, and Installation Instructions.