Best Practice | New orderBy parameter for API sorting
  • 11 Dec 2025
  • 1 Minute to read
  • Dark
    Light

Best Practice | New orderBy parameter for API sorting

  • Dark
    Light

Article summary

Introduction

Starting from Nexus 1, a new sorting query parameter will be available to simplify sorting behaviour and ensure consistent pagination results across CMiC APIs. When applied, this parameter automatically uses the default sort order defined in the underlying database view, eliminating the need to manually specify sort columns.

orderBy=default

This parameter is compatible with all existing query features, including:

  • Finders
  • Pagination (limit & offset)
  • q parameter
  • totalResults
  • fields=parameter
Example
/hcm-rest-api/rest/1/pyemployee?finder=PyEmployeeFinder;EmpStatusVar=A&q=EmpCompCode='ZZ'&fields=EmpNo,EmpCompCode,EmpFirstName,EmpLastName,EmpEmailAddress,EmpStatusDesc,EmpStatus,EmpCellPhone,EmpLastUpdDate,EmpVUuid&limit=200&orderBy=default
Note

orderBy=default cannot be used for explicit sorting.

For example,

orderBy=default&orderBy=ColumnName:asc

Currently supported APIs

We will continue rolling out orderBy=default support across all CMiC API views to simplify integration patterns, improve consistency, and reduce pagination-related issues.

The following APIs are supported now:

Accounts Payable:

ap-rest-api/rest/1/apallvoucher
ap-rest-api/rest/1/apvendor

Accounts Receivable:

ar-rest-api/rest/1/arcustomer
ar-rest-api/rest/1/arinvoice

System:

sys-rest-api/rest/1/businesspartner

Inventory:

ci-rest-api/rest/1/ciitem

Potential Change Items (PCI)

cm-rest-api/rest/1/cmdetail
cm-rest-api/rest/1/cmmast

Human Capital Management (HCM)

hcm-rest-api/rest/1/employees
hcm-rest-api/rest/1/pyetimesheet

Job Cost

jc-rest-api/rest/1/jcdetailposted
jc-rest-api/rest/1/jcjob
jc-rest-api/rest/1/jcjobcategory

Project Management

pm-rest-api/rest/1/pmproject

Subcontract

pm-rest-api/rest/1/scmast
pm-rest-api/rest/1/scsched

Purchase Order

po-rest-api/rest/1/podetail
po-rest-api/rest/1/pomaster

General Ledger

gl-rest-api/rest/1/rtiledgerwithyearperiod
glrestapi/rest/v1/glperactivitylog

Continued Support for Manual Sorting

Users can continue to use manual sorting for APIs not yet supported, provided that the API has been properly indexed.

Example
orderBy=ColumnName:asc
orderBy=ColumnName:desc

If any deviation is encountered, please reach out to CMiC Support.