Sorting
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 the fields provided.
Sort Fields
Sort By | Sort Field Example |
---|---|
Name ( |
|
Format ( |
|
Version - String-based ( |
|
Status ( | |
Size in Bytes ( |
|
Downloads ( |
|
Date ( |
|
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 can also be combined with querying - if you wanted to sort by most downloaded for 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
Sorting Packages via the Website UI
At the top of each repository detail page is the sort header:


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.
Updated 5 months ago