Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Product Management Domain > Retrieving the Consolidated Components List for a Part Structure
  
Retrieving the Consolidated Components List for a Part Structure
Using the GetMultiLevelComponentsReport action, you can retrieve any of the following lists depending on the value specified for the ShowSingleLevelReport flag:
A consolidated flat list of leaf node components and their total quantity within an entire part structure (multi-level component list).
A consolidated flat list of components and their total quantity that are directly used by the specified part structure (single-level consolidated BOM).
You can retrieve the consolidated multi-level component list when the value of ShowSingleLevelReport is false.
* 
When the ShowSingleLevelReport flag is not specified in the request body, its default value is false.
You can retrieve the single-level consolidated BOM when ShowSingleLevelReport is specified as true in the request body.
Example: Retrieving the Multi-Level Component List for a Part Structure
This example shows you how to retrieve the consolidated leaf node components in the Released state with the total quantity and their unit within an entire part structure.
The action consolidates different uses of the same unit of a leaf node component and returns them as one leaf node with the total quantity and its unit.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:193450')/PTC.ProdMgmt.GetMultiLevelComponentsReport?$select=ID,Name,Quantity,Unit,Resolved,HasChildren&$expand=Part($select=Identity,Name)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartStandardConfigSpec",
"WorkingIncluded": false,
"View": "Design",
"LifeCycleState": {
"Value": "RELEASED",
"Display": "Released"
},
"Variation1": null,
"Variation2": null
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"UseDefaultForUnresolved": false
}
}
The request returns the consolidated leaf node components with their total Quantity and Unit for the part structure specified in the request URI.
Example: Retrieving the Single-Level Consolidated BOM for a Part Structure
This example shows you how to retrieve the single-level consolidated components in the Released state with their total quantity and unit for the specified part structure. In this example, the value of ShowSingleLevelReport is specified as true in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:193450')/PTC.ProdMgmt.GetMultiLevelComponentsReport?$select=ID,Name,Quantity,Unit,Resolved,HasChildren&$expand=Part($select=Identity,Name)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartStandardConfigSpec",
"WorkingIncluded": false,
"View": "Design",
"LifeCycleState": {
"Value": "RELEASED",
"Display": "Released"
},
"Variation1": null,
"Variation2": null
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"UseDefaultForUnresolved": false
},
"ShowSingleLevelReport": true
}
Example: Retrieving the Single-Level Consolidated BOM Along with the Associated CAD Documents and Attachments in a Part Structure
This example shows you how to retrieve the single-level consolidated components along with the associated CAD documents and their PDF attachments using an expand on Part, PartDocAssociations, and Attachments along with a filter.
In this example, the value of ShowSingleLevelReport is specified as true in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:196831')/PTC.ProdMgmt.GetMultiLevelComponentsReport?$select=Name,Number,Quantity,Unit&$orderby=Number asc&$expand=Part($select=Identity;$expand=PartDocAssociations($expand=RelatedCADDoc($select=Identity;$expand=Attachments($select=PTC.ApplicationData/MimeType,PTC.ApplicationData/FileName;$filter=(PTC.ApplicationData/MimeType eq 'application/pdf')))))
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartStandardConfigSpec",
"WorkingIncluded": false,
"View": "Design",
"LifeCycleState": {
"Value": "RELEASED",
"Display": "Released"
},
"Variation1": null,
"Variation2": null
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"UseDefaultForUnresolved": false
},
"ShowSingleLevelReport": true
}
The request returns the single-level consolidated components with the total Quantity and Unit along with the associated CAD documents and their PDF attachments for the part structure specified in the request URI.
Example: Retrieving the Multi-Level Component List When Path Filters Are Applied As Navigation Criteria in a Part Structure
This example shows you how to retrieve the consolidated leaf node components with their total quantity and unit when path filters are applied in a part structure.
In this example, a path filter is applied as navigation criterion to a leaf node each in two different subassemblies.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:193749')/PTC.ProdMgmt.GetMultiLevelComponentsReport?$select=Quantity,Unit,Name,Number&$expand=Part($select=Identity,Name)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [],
"Filters": [
{
"@odata.type": "#PTC.NavCriteria.UsagePathFilter",
"RootIdentifier": "wt.part.WTPart:193749",
"Paths": [
{
"DisplayPath": "Parent|Child2|Child21",
"InternalPath": "8b51d1b0-47cc-4167-b966-e6d7c26ffc93|ddc2f10d-4e9b-4eab-b6c8-840cc330286a"
},
{
"DisplayPath": "Parent|Child3|Child31",
"InternalPath": "611f18ad-b439-4df2-814c-e67d92c52ab4|b87a2b09-8bb6-4107-bf13-83e85552c837"
}
]
}
]
}
}
The request consolidates different uses of Child21 of the same unit within the subassembly for which the path filter is applied, and returns them as one Child21 leaf node with the total quantity and its unit.
The request consolidates different uses of Child31 of the same unit within the subassembly for which the path filter is applied, and returns them as one Child31 leaf node with the total quantity and its unit.
The request returns each consolidated Child21 and Child31 leaf component with their total Quantity and Unit, respectively.
For example, consider a car assembly in which a path filter is applied to the engine subassembly component and another path filter is applied to the exhaust system subassembly component. The request consolidates the same leaf nodes, such as valve components of the unit “each” within the engine subassembly, and lists the “valve” component only once with the total quantity and a unit “each”. Similarly, the request consolidates the same leaf nodes, such as sleeve components of the unit “each” within the exhaust system subassembly, and lists the “sleeve” component only once with the total quantity and a unit “each”. When both the engine and exhaust system subassemblies use a common fastener such as “bolt”, this request consolidates the common leaf node component “bolt” of the unit “each” within both the engine and exhaust system subassemblies and returns it only once with the total quantity and unit of “each”.