Sorting Packages via the Website UI

At the top of each repository detail page is the sort header:

11781178

Clicking once will sort by descending order, clicking again will sort by ascending order, and finally, a third click will clear the sort.

Note that currently, the UI only supports sorting by one field at a time.

Sorting Packages via the Cloudsmith API

Please see the Cloudsmith API interactive sandbox and the full API reference.


Sorting search results is simple with Cloudsmith. A collection of one or more fields can be supplied in CSV (comma-separated value) format, and the results will be sorted based on the order of the fields provided.

Sort Fields

Sort By

Sort Field Example

Name (name)

-name (sort by name alphabetically)

Format (format)

-format (sort by format alphabetically e.g. alphine, maven, python)

Version - String-based (version)

-version (sort by version, greatest first e.g. 1.2.1, 1.2.0, 1.1.0)

Status (status)

Size in Bytes (size)

-size (sort by size in bytes, largest package first)

Downloads (downloads)

downloads (sort by downloads ascending e.g. 0, 10, 50, 1,000)

Date (date)

-date (sort by uploaded time, most recent first)

For all fields you can use:
- to sort by descending order. (Example: -date, -version)

A Short Worked Example

Suppose that you had the following packages:

Name

Format

Size

Version

Downloads

cloudsmith-example-cli

Python

722

1.2.0

500

cloudsmith-example-cli

Python

719

1.1.5

1000

cloudsmith-java-app

Maven

6910

1.0.0

2500

cloudsmith-example-pdf

Raw

309

2.0.0

100

To sort packages by size descending, your sort query would be:

-size

Which would provide the following results

  • cloudsmith-java-app, Size: 6910 bytes
  • cloudsmith-example-cli, Size: 722 bytes
  • cloudsmith-example-cli, Size: 719 bytes
  • cloudsmith-example-pdf, Size: 309 bytes

To sort packages by format alphabetically, with version descending, your sort query would be:

-format,-version

Which would provide the following results:

  • cloudsmith-java-app, Format: Maven, Version: 1.0.0
  • cloudsmith-example-cli, Format: Python, Version: 1.2.0
  • cloudsmith-example-cli, Format: Python, Version: 1.1.5
  • cloudsmith-example-pdf, Format: Raw, Version: 1.1.0

Sorting combined with Searching

Sorting can also be combined with querying. If you wanted to sort by most downloaded Python packages, your query and sort would be:

query=format:python&sort=-downloads

Which would provide the following results:

  • cloudsmith-example-cli, Format: Python, Version: 1.2.0, Downloads: 1000
  • cloudsmith-example-cli, Format: Python, Version: 1.2.0, Downloads: 500


Did this page help you?

Cloudsmith is the new standard in Package / Artifact Management and Software Distribution

With support for all major package formats, you can trust us to manage your software supply chain.


Start My Free Trial Now
Cookie Declaration (Manage Cookies)