Skip to main content
6-Contributor
September 2, 2024
Solved

How to fetch part list using custom attribute via Windchill odata rest api?

  • September 2, 2024
  • 1 reply
  • 2715 views

Version: Windchill 13.0

 

Use Case: To get list of parts based on custom attribute, For ex : Type : WTPart Attribute Name : Model Values : "PC00123", "PC00456"


Description:

Need to fetch list of part using custom attributes(IBA), tried below solution but didn't work.

 

URL : 

/Windchill/servlet/odata/ProdMgmt/Parts?$filter=startswith(Number,'P91-') and contains(Model,'PC00456')

 

Error :  The property 'Model', used in a query expression, is not defined in type 'PTC.ProdMgmt.Part'

 

Note : "Model" is internal name of attribute.

 

Please let me know if you need anything and do you have any solution on this.

 

Thanks.

 

Best answer by rhart

/Windchill/servlet/odata/v6/ProdMgmt/Parts/PTC.ProdMgmt.com.lt.bom_part?$filter=startswith(Number,'P91-') and contains(Model,'PC00456')

 

ETA: works if underscore is removed from internal type name

1 reply

16-Pearl
September 2, 2024
Windchill/servlet/odata/v7/ProdMgmt/Parts?$filter=startswith(Number,'P91') and contains(PTC.ProdMgmt.<internal name of part type>/Model,'PC00456')&$count=false

Need to include the internal name of part type which defines 'Model' attribute

6-Contributor
September 3, 2024

Hi @rhart 

Thanks for quick response,

Added internal name of part type which defines 'Model' attribute 

PTC.ProdMgmt.com.lt.bom_part/Model

but still getting error as below :

 

{
"error": {
"code": null,
"message": "The URI is malformed."
}
}
 

Let me know if anything is missing.

 

thanks.

16-Pearl
September 3, 2024

Error says "The URI is malformed." so perhaps you should show the URI and then someone might have another idea what the reason could be.