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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Product Management - getPartStructure API

AP_10343008
15-Moonstone

Product Management - getPartStructure API

In Windchill Rest Services Product Management>getPartStructure

I used $expand = Components($expand=Part,PartUse;$levels=max)  API , It executed for 4 mins. To reduce execution time, i want to provide 3 field names in $select query. Kindly refer the attached JSON document to form the query to fetch the field 'PartNumber, ComXXXEngineeringSequences, ItemTypeComXXXIndustriesItemType'.

 

I able to fetch two fields using query 
$expand = Components($expand=PartUse($select=ComXXXEngineeringSequences))

 

But when I tried to fetch ItemTypeComXXXIndustriesItemType using query $expand=  Components($expand=Part($select=ItemTypeComPolarisindPolarisIndustriesItemType);$levels=max)
It throwed error  [ - The property 'ItemTypeComXXXItemType', used in a query expression, is not defined in type 'Part'.]

 

Kindly check the attached file and let me know how to fetch 'PartNumber, ComXXXEngineeringSequences, ItemTypeComXXXIndustriesItemType' together.

8 REPLIES 8

Hi @AP_10343008 

If you use wt.part.WTPart as a type does it work?

 

try to use a full path definition type "wt.part.WTPart|ItemTypeComPolarisindPolarisIndustriesItemType"

 

PetrH

I tried the query Components($expand=Part($select=wt.part.WTPart|ItemTypeComPolarisindPolarisIndustriesItemType)) 
It throwed error  [ - The part 'wt.part.WTPart' is not defined.]

@AP_10343008 

You need to find how the type should be exactly defined 😄 

PetrH

Hi @AP_10343008 

Try this one> WCTYPE|wt.part.WTPart|ItemTypeComPolarisindPolarisIndustriesItemType

 

aslo check internal name of the type ItemTypeComPolarisindPolarisIndustriesItemType there should be full internal name.

 

PS: check this article, CS317238 - How to use the PTC.ProdMgmt.GetPartStructure function in Windchill REST Services

I guess  that your definition for select and your subtype is wrong. 

PetrH

OP is using GetPartStructure and 'Namespace is not allowed for Entity Sets', this make sense since it will retrieve several subtypes in the structure, not all of them having the $select attribute. However there should be a solution for this as json is flexible and and does not enforce type definition.

Hi @CR_9630881 

The Json is flexible, but the background API in the Windchill is not. 

You could find that your definition needs to be in exact format or it does not work. 

 

Iam not the one who knows how the restapi input should look like but I'm trying to help. 

I just know that some APIs work with the mentioned definition. 

 

Sure you can write own REST API and background java API that will do what ever you want. 

It needs customization. 

 

PetrH 

Ok. Thank you

@HelesicPetr i totally agree with you that WRS has its own ways and it is what it is.

Windchill internal models might not be as flexible, it's a disagreement for us but I guess it allows to enforce the stability of the overall tool.

 

@AP_10343008 , since we have the same kind of issues here (and much more on several other topics) we ended up adding a middleware alongside Windchill Server, we are now able to :

- return any http status code we want 

- choose our return format (xml, json...)

- do intermediate operation, including mixing data from WRS and info*engine requests for example, or getting data from other systems

- overload authentication, add RBAC, whitelisting requests origin, setup CORS policies....

 

As for your example, we still use the getPartStructure without a select statement for Part and rework the received json as needed, for our use case it divides by 6 the size of the json we return in the end.

However, this is not suitable for synchrone requests because of the time it takes (around 17 seconds in our use case)

 

Announcements

Top Tags