Skip to main content
pshashipreetham
18-Opal
18-Opal
May 9, 2023
Solved

How to know a part has structure or not

  • May 9, 2023
  • 2 replies
  • 1405 views

Hi,

 

Is there a REST API or Swagger where I can input the Part number and know if it has a part structure?

 

Use Case: If a part has a part structure, display the part structure in Thingworx Dashboard, or else display just the part info.

 

For this use case, I need to know if there is an API, I can ping and understand if the Part has structure or not.

 

Thanks,

 

 

Best answer by pshashipreetham

Hello,

 

I found the simplest way to know if a part has the structure or not; below is the implementation:

pshashipreetham_0-1697782211431.png

In the JSON, if HasChildren is true, there is structure to the Part. If not, there is no structure to it.

If you need the whole structure to the Part, then add the below to the expand: 

 

$expand: "Components($expand=Part,PartUse;$levels=1)",

 

 

Thanks,

2 replies

19-Tanzanite
May 9, 2023

Hi @pshashipreetham 

 

If you have Thingworx Navigate Configured, you can use the 'getPartStructureByID' service ( service will be available in Windchill ODataConnector ) to fetch part structure windchill using Part ID ( not part Name )

 

If the 'Components' array is empty you can consider your part doesn't have any structure

 

Velkumar_0-1683621430651.png

 

If your part has structure result will look something like this 

 

Velkumar_1-1683621633571.png

 

In WRS, you can use the below endpoint to fetch the part structure

Velkumar_2-1683621996315.png

 

/VR

 

pshashipreetham
18-Opal
pshashipreetham18-OpalAuthorAnswer
18-Opal
October 20, 2023

Hello,

 

I found the simplest way to know if a part has the structure or not; below is the implementation:

pshashipreetham_0-1697782211431.png

In the JSON, if HasChildren is true, there is structure to the Part. If not, there is no structure to it.

If you need the whole structure to the Part, then add the below to the expand: 

 

$expand: "Components($expand=Part,PartUse;$levels=1)",

 

 

Thanks,