Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Version: Windchill 12.1
Use Case: I am attempting to do an OData call to retrieve parts filtered by a custom attribute on a part. How do I do a GET request with a $filter that allows me to filter a custom attribute?
Description:
Attempted URL:
Error message:
{
"error": {
"code": null,
"message": "The property 'MY_ITEM_NUMBER', used in a query expression, is not defined in type 'PTC.ProdMgmt.Part'."
}
}
URL's I've tried that do not work:
Error message:
{
"error": {
"code": null,
"message": "The URI is malformed."
}
}
Other URLs:
I tried following the steps here without success: https://community.ptc.com/t5/Windchill/How-to-fetch-part-list-using-custom-attribute-via-Windchill/m-p/969188#M81973
Is this possible? Seems like it should be a common thing to do, but I haven't found much help online or in the KBs. Thanks for the help in advance!
Hi @CB_12625553
Thank you for your question.
Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.
Also, feel free to add any additional information you think might be relevant. It sometimes helps to have screenshots to better understand what you are trying to do.
Best regards,
Hi,
Please map the property MY_ITEM_NUMBER in PartsExt.json file in the custom rest folder. You could be able to filter based on custom attribute. Refer Adding Custom Properties to Entities in PTC Domains.
PartsExt.json
{
"extends": "Part",
"attributes": [
{
"name": "MY_ITEM_NUMBER",
"internalName": "MY_ITEM_NUMBER",
"type": "String"
}
]
}
Post the above step you can apply filter like below