Support for $orderby on Navigation Properties
The Windchill REST Services framework supports $orderby query parameter for following navigation properties in the PTC Document Management, PTC Product Management, and PTC Change Management domains. This section describes the navigation properties that support the $orderby query parameter.
Context
You can sort a collection of change objects, documents, or parts using the $orderby parameter on the Context navigation property. The sorting is supported for the Name property of the Container entity.
For example:
/DocMgmt/Documents?$orderby=Context/Name asc
This URL performs an ascending sort on documents, based on the name of the context.
/ProdMgmt/Parts?$orderby=Context/Name desc
This URL performs a descending sort on parts, based on the name of the context.
/ChangeMgmt/ChangeRequests('<change_request_ID>')?$expand=AffectedObjects($orderby=Context/Namedesc)
This URL performs a descending sort on all the affected objects on the context name.
Organization
You can sort a collection of change objects, documents, or parts using the $orderby parameter on the Organization navigation property. The sorting is supported for the Name property of the Organization entity.
For example:
/DocMgmt/Documents?$orderby=Organization/Name desc
This URL performs a descending sort on documents, based on the name of the organization.
Folder
You can sort a collection of parts or documents using the $orderby parameter on the Folder navigation property. The sorting is supported for Name, Location, and Description properties of the Folder entity.
For example:
/ProdMgmt/Parts?$expand=Folder&$orderby=Folder/Name asc
This URL performs an ascending sort on parts, based on the folder name.
Attachments
You can sort a collection of change objects or documents using the $orderby parameter on the Attachments navigation property.
The sorting is supported for FileName, Description, Format, and FileSize properties of the associated attachment.
For example:
/DocMgmt/Documents('<document_ID>')?$expand=Attachments/PTC.ApplicationData($orderby=FileNameasc)
This URL performs an ascending sort on all the attachments by their file names.
/ChangeMgmt/ChangeRequests('<change_request_ID>')?$expand=Attachments/PTC.ApplicationData($orderby=FileSizedesc)
This URL performs a descending sort on all the attachments by their file size.
PrimaryContent
You can sort a collection of documents using the $orderby parameter on the PrimaryContent navigation property.
The sorting is supported for FileName, Description, Format, and FileSize properties of the associated primary content.
Representation
You can sort a collection of parts using the $orderby parameter on the Representation navigation property.
The sorting is supported for Name, DefaultRepresentation, FormatName, and OutOfDate properties of the associated representation.
For example:
/ProdMgmt/Parts('<part_ID>')?$expand=Representations($orderby=Nameasc)
This URL performs an ascending sort on all the representations of the part by their name.