cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

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

NM_11004954
6-Contributor

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

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.

 

ACCEPTED SOLUTION

Accepted Solutions

/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

View solution in original post

8 REPLIES 8

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

NM_11004954
6-Contributor
(To:rhart)

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.

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.

NM_11004954
6-Contributor
(To:rhart)

Below url used : 

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

/Windchill/servlet/odata/v6 uri is malformed

/Windchill/servlet/odata/v7 working

 

ETA: need to remove the underscore from internal type name

NM_11004954
6-Contributor
(To:rhart)

for /v7 getting below error:

 

{
"error": {
"code": "REQUESTED_VERSION_NOT_FOUND",
"message": "Requested version is not found."
}
}

/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

NM_11004954
6-Contributor
(To:rhart)

Hi @rhart 

Its working as per below change in url

Changes :

1. after removed _ (underscore) from internal name

2. Instead of /v6/ used /v2/

 

Thank you very much  for your support.

 

Thanks.

Announcements


Top Tags