Windchill REST Services > Windchill REST Services Framework Capabilities > Support for OData > OData Query Parameters > Support for $filter on Navigation Properties
  
Support for $filter on Navigation Properties
The Windchill REST Services framework supports $filter query parameter for some navigation properties in the PTC CAD Document Management, PTC Document Management, PTC Product Management, PTC Product Platform Management, PTC Data Administration, 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/PTC.ApplicationData?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/PTC.ApplicationData?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.
/ProdMgmt/Parts(‘<oid>’)/Attachments/PTC.ApplicationData?$filter=ID eq 'OR:wt.content.ApplicationData:277096' or FileName eq 'certificate.pdf'&$select=ID,CreatedBy,FileName&$count=true
* 
You must use PTC.ApplicationData/<attribute> in the request URI when you use filter on the Content, FileName, FileSize, Format, or MimeType attributes.
This URL returns the attachment with the specified ID or file name for the specified part.
* 
$filter is not supported on the Attachments navigation property in the GetPartStructure action.
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.
$filter by ID, View, CreatedBy, or ModifiedBy
The following examples show how to use $filter by ID, View, CreatedBy, or ModifiedBy on navigation properties:
GET request:
/CADDocumentMgmt/CADDocuments('<OID>')/PartDocAssociations?$filter=RelatedPart/ID ne ‘RedPartOID’ and AssociationType/Value eq ‘OWNER’&$select=AssociationType/Value&$count=true
GET request:
/CADDocumentMgmt/CADDocuments('<OID>')/DerivedSources?$filter=SourceCADDocuments/ID eq ‘oid’&$count=true
GET request:
/ProdMgmt/Parts('<OID>')/Uses?$select=LineNumber&$filter=((Uses/ID eq 'child1PartOID' or Uses/ID eq ‘child2PartOID’) and Uses/View eq ‘Design’)&$count=true
GET request:
/ProdMgmt/Parts('<OID>')/PartDocAssociations?$filter=RelatedCADDoc/ID ne ‘DrwOID’ and RelatedCADDoc/State/Value eq ‘RELEASED’&$orderby=ID&$count=true
GET request:
/ProdPlatformMgmt/Option('<OID>')/Choices?$filter=ModifiedBy eq ‘Site, Administrator’ and State/Value eq ‘INWORK’&$select=Name,Version,ModifiedBy,LastModified,Latest&$orderby=LastModified desc&$count=true
GET request:
/DataAdmin/Containers('{0}')/Folders('{1}')/Folders?$filter=ID eq '<OID1>' or Name eq ‘Configurable Module’&$select=Folders/Name&$count=true