Sorting

Sort rows using the sort query parameter on the GET /api/v1/bridge/{bridgeId}/{sheetId} endpoint. Sorting is applied after filtering and supports single or multiple columns.

Single Column Sorting

Sort by a single column in ascending order:

GET /api/v1/bridge/{bridgeId}/{sheetId}?sort=Name

Sort by a single column in descending order (prefix with -):

GET /api/v1/bridge/{bridgeId}/{sheetId}?sort=-created_at

Multi-Column Sorting

Sort by multiple columns by separating them with commas. Columns are sorted in order of priority:

GET /api/v1/bridge/{bridgeId}/{sheetId}?sort=author,-title,date

This sorts by:

  1. author in ascending order
  2. title in descending order (for rows with the same author)
  3. date in ascending order (for rows with the same author and title)

Column Name Resolution

Column names are resolved using the same header mapping system as filtering:

  • Normalized headers (spaces removed, lowercase)
  • Canonical keys
  • Case-insensitive label matching

You can use any of these formats:

  • Original column label: ?sort=Full Name
  • Normalized header: ?sort=fullname
  • Canonical key: ?sort=full_name

Value Comparison

The sorting service intelligently compares values:

  • Numeric values: Sorted numerically (e.g., 2 comes before 10)
  • String values: Sorted case-insensitively (e.g., apple and Apple are treated the same)
  • Null values: Always pushed to the end of the sorted results

Combining with Other Parameters

Sorting can be combined with filtering and metadata:

GET /api/v1/bridge/{bridgeId}/{sheetId}?filter[Status]=active&sort=-created_at&meta=true

This will:

  • Filter rows where Status equals active
  • Sort results by created_at in descending order
  • Include metadata in the response

Unknown Columns

If you specify a column that doesn't exist in the sheet, it will be silently ignored. The request will still succeed, but that sort directive will have no effect.


Powered by Converge