Support for $filter on Navigation Properties
The Windchill REST Services framework supports $filter query parameter for some navigation properties in the PTC Document Management, PTC Product Management, and PTC Change Management domains. The $filter options such as contains, startswith, and so on, are supported. This section describes the navigation properties that support the $filter query parameter.
See the section Configuring Navigation Properties for more information on setting up navigation properties.
Context
You can query for a collection of change objects, parts, or documents using the $filter parameter on the Context navigation property. The filtering is supported for the Name property of the Container entity.
For example:
/DocMgmt/Documents?$filter=contains(Context/Name,'<substring_of_containername>')
This URL returns all the documents that are available in all the containers with a name that contains the specified substring. For example, if you specify the substring as Cart, then the URL returns all the documents that are available in all the containers with a name that contains the substring Cart.
/ProdMgmt/Parts?$filter=Context/Name eq '<container_name>'
This URL returns all the parts that are available in the specified container.
/ChangeMgmt/ChangeRequests('<change_request_ID>')?$expand=AffectedObjects($filter=Context/Name eq 'Power System')
This URL returns all the affected objects that have the context name set as Power System in the specified change request ID.
Organization
You can query for a collection of change objects, parts, or documents using the $filter parameter on the Organization navigation property. The filtering is supported for the Name property of the Organization entity.
For example:
/DocMgmt/Documents?$filter=Organization/Name eq '<organization_principal_name>'
This URL returns all the documents that are available in the specified organization.
Folder
You can query for a collection of parts or documents using the $filter parameter on the Folder navigation property. The filtering is supported for the Name and Description properties of the Folder entity.
For example:
/ProdMgmt/Parts?$filter=Folder/Description eq '<folderdescription>'
This URL returns parts that are available in the folders with the specified folder description.
Attachments
You can query for a collection of change objects or documents using the $filter parameter on the Attachments navigation property.
The filtering is supported for FileName, Description, Format, and FileSize properties of the associated attachment.
For example:
/DocMgmt/Documents?$filter=Attachments/any(d:d/PTC.ApplicationData/Description eq '<attachmentdescription>')
This URL returns all the documents that contain the specified description for attachments.
/DocMgmt/Documents?$filter=Attachments/any(d:contains(d/PTC.ApplicationData/Format,'<attachmentformat>'))
This URL returns all the documents that have attachments in the specified type of format.
/ChangeMgmt/ChangeRequests('<change_request_ID>')/Attachments/PTC.ApplicationData?$filter=contains(FileName,'xyz.pdf')
This URL returns all the attachments that contain the specified file name for the specified change request.
PrimaryContent
You can query for a collection of documents using the $filter parameter on the PrimaryContent navigation property.
The filtering is supported for FileName, Description, Format, and FileSize properties of the associated primary content.
For example:
/DocMgmt/Documents?$filter=PrimaryContent/PTC.ApplicationData/FileSize eq <doublevalue>
This URL returns all the documents with primary content of the specified size.
Representation
You can query for a collection of parts using the $filter parameter on the Representation navigation property.
The filtering is supported for Name, Description, DefaultRepresentation, FormatName, and OutOfDate properties of the associated representation.
For example:
/ProdMgmt/Parts?$filter=Representations/any(d:d/OutOfDate eq true)
This URL returns all the parts with representations that are out-of-date.
/ProdMgmt/Parts?$filter=Representations/any(d:startswith(d/Name,'<substring_of_representation_description>'))
This URL returns all the parts that have representations with the specified representation description.