Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC BOM Transformation Domain > Adding Scrap Parts to Co-produce Objects
  
Adding Scrap Parts to Co-produce Objects
You can add one or more scrap parts as secondary members to a single or multiple Co-produce objects only in the independent co-produce mode.
* 
Independent co-produce mode is enabled when the mpml.coproduce.manageIndependentCoproduce property in the wt.properties file is set to true.
You can add one or more scrap parts by specifying the co-produce OIDs and scrap part OIDs in the request body. To add the scrap parts to a Co-produce object, you must first check out the Co-produce object. You must have Modify permissions to the object.
* 
You can only add part OIDs as the scrap part OIDs.
You cannot add the part OIDs of Made From Set or Co-produce objects as scrap parts.
You cannot add primary and secondary co-produce objects as scrap parts.
You can also choose to add the scrap parts in context of change (change task or change notice). You must first reserve the change object for Edit.
Example: Adding Multiple Scrap Parts to Multiple Co-produce Objects
This example shows you how to add two scrap parts to each of the two Co-produce objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddScrapMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:389121"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:388934"
},
{
"ID": "OR:wt.part.WTPart:388944"
}
]
},
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:389174"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:388941"
},
{
"ID": "OR:wt.part.WTPart:388951"
}
]
}
]
}
Example: Adding Multiple Scrap Parts to a Co-produce Object in Context of Change
This example shows you how to add two scrap parts to a Co-produce object in context of change specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddScrapMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:389121"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:388998"
},
{
"ID": "OR:wt.part.WTPart:388878"
}
]
}
],
"ChangeOid": "VR:wt.change2.WTChangeActivity:363753"
}