Retrieving the Part Structure
This example shows you how to retrieve a part structure using expand on components.
In this example, the Top_WTPart root part has the Child1 and Child2 child components under it. The Child1 part has the Child1_A child component under it. Child1_A further has Child1_A1 under it. Child2 has no child parts.
Consider that the user does not have access to the Child1_A1 child component.
Use the following POST request.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:191559')/PTC.ProdMgmt.GetPartStructure?$expand=Components($levels=max)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{}
Response
{
"@odata.context": "$metadata#PartStructureItems",
"PartId": "OR:wt.part.WTPart:191559",
"HasChildren": true,
"PartUseId": null,
"PartName": "Top_WTPart",
"PartNumber": "0000000007",
"PathId": null,
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": true,
"PVTreeId": "/",
"PVParentTreeId": null,
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Kolkata",
"Components": [
{
"HasChildren": true,
"PartName": "Child1",
"PartNumber": "0000000008",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": [
{
"HasChildren": true,
"PartName": "Child1_A",
"PartNumber": "0000000009",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": [
{
"HasChildren": false,
"PartName": "Child1_A1",
"PartNumber": "0000000010",
"Resolved": false,
"HasUnresolvedObjectsByAccessRights": null
}
]
}
]
},
{
"HasChildren": false,
"PartName": "Child2",
"PartNumber": "0000000011",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": []
}
]
}
The request returns the value of HasUnresolvedObjectsByAccessRights as true for the root part specified in the request URI.
The request returns Resolved as true for all components in the part structure except for Child1_A1 as Child1_A1 is unresolved. Hence, Resolved and HasChildren are returned as false for Child1_A1.
HasChildren is also returned as false for Child2 component as it does not have child parts under it.
Example: Retrieving the Part Structure Using Navigation Criteria
This example shows you how to retrieve a part structure using navigation criteria by specifying the navigation criteria ID in the request body.
In this example, the Top_WTPart root part has the Child1 and Child2 child components under it. The Child1 part has the Child1_A child component under it. Child1_A further has Child1_A1 under it. Child2 has no child parts.
According to the navigation criteria applied, the Child1_A1 component is unresolved.
Use the following POST request with expand.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:191559')/PTC.ProdMgmt.GetPartStructure?$expand=Components($levels=max)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.CADDocumentMgmt.CADDocument",
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.EPMDocStandardConfigSpec",
"WorkingIncluded": false,
"LifeCycleState": {
"Value": "INWORK",
"Display": "In Work"
}
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"ID": "OR:wt.filter.NavigationCriteria:215079",
"UseDefaultForUnresolved": false
}
}
Response
{
"@odata.context": "$metadata#PartStructureItems",
"PartId": "OR:wt.part.WTPart:191559",
"HasChildren": true,
"PartUseId": null,
"PartName": "Top_WTPart",
"PartNumber": "0000000007",
"PathId": null,
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": false,
"PVTreeId": "/",
"PVParentTreeId": null,
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Kolkata",
"Components": [
{
"HasChildren": true,
"PartName": "Child1",
"PartNumber": "0000000008",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": [
{
"HasChildren": true,
"PartName": "Child1_A",
"PartNumber": "0000000009",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": [
{
"HasChildren": false,
"PartName": "Child1_A1",
"PartNumber": "0000000010",
"Resolved": false,
"HasUnresolvedObjectsByAccessRights": null
}
]
}
]
},
{
"HasChildren": false,
"PartName": "Child2",
"PartNumber": "0000000011",
"Resolved": true,
"HasUnresolvedObjectsByAccessRights": null,
"Components": []
}
]
}
In this example, HasUnresolvedObjectsByAccessRights is returned as false for the root part specified in the request URI.
The request returns Resolved as false for Child1_A1 as it is unresolved.
The request returns HasChildren as true for all components in the part structure except for Child1_A1 as Child1_A1 is unresolved.
HasChildren is returned as false for Child2 as it does not have child parts under it.
Additionally, you can use the following expansions:
URI with Expand
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:191559')/PTC.ProdMgmt.GetPartStructure?$expand=Components($expand=Part($select=Identity;$expand=Representations($select=CreoViewURL),References($select=ID;$expand=References($select=Identity;$expand=PrimaryContent($select=FormatIcon))),DescribedBy($select=ID;$expand=DescribedBy($select=Identity;$expand=PrimaryContent($select=FormatIcon)))),Occurrence($select=BuildStatus/Display);$levels=max)
URI with Expand
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:191559')/PTC.ProdMgmt.GetPartStructure?$expand=Components($select=PartName,Resolved,HasChildren,HasUnresolvedObjectsByAccessRights;$levels=max)