Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC BOM Transformation Domain > Adding Secondary Objects to Co-produce Objects
  
Adding Secondary Objects to Co-produce Objects
You can add existing single or multiple Secondary objects to existing single or multiple Co-produce objects by specifying the Co-produce object OIDs and Secondary object OIDs in the request body. You can provide either Part objects or Made From Set objects as Secondary objects. You can add only one Made From Set OID from a given Part as Secondary object.
You can also choose to add Secondary objects to Co-produce objects in context of Change (Change Task or Change Notice).
You must have Modify access to the Co-produce and Change objects.
* 
If you provide the OIDs of Made From Set or Part objects that are already added as Secondary objects in a Co-produce object, then the request ignores such objects.
Primary and Secondary Part or Made From Set OIDs cannot be the same.
If you specify the OID of a Made From Set from a given Part as Secondary object OID, then
The OID cannot belong to any other Made From Set that is under the parent Primary or Secondary Part.
The OID cannot belong to the Made From Set that is under the Primary Part.
You can add the same Part or Made From Set object as Secondary object, only once.
All Primary or Secondary Parts added to a Co-produce object must either have usage links under them or combination of Raw Material links and Made From Set (Made From Set can only have Raw Material links under it).
Example: Adding Multiple Secondary Objects to Multiple Co-produce Objects
This example shows you how to add two Part objects as Secondary objects in 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/AddCoproduceMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:216069"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:216001"
},
{
"ID": "OR:wt.part.WTPart:216017"
}
]
},
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:216090"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:216001"
},
{
"ID": "OR:wt.part.WTPart:216017"
}
]
}
]
}
Similarly, you can add multiple Made From Set objects as Secondary objects to single or multiple Co-produce objects specified in the request body.
Example: Adding a Secondary Object to a Co-produce Object
This example shows you how to add a Part as Secondary object to a Co-produce object along with the child Parts under the Part object. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddCoproduceMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:203236"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:198549"
}
]
}
]
}
Similarly, you can add a Made From Set as Secondary object to the Co-produce object along with the Raw Material parts under the Made From Set object.
Example: Adding a Secondary Object to a Co-produce Object for a Specific Navigation Criteria
This example shows you how to add a Part as Secondary object to a Co-produce object for a specific Navigation Criteria. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddCoproduceMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:199424"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:199349"
}
]
}
],
"navigationCriteriaId": "OR:wt.filter.NavigationCriteria:199219"
}
Similarly, you can add a Made From Set as Secondary object to the Co-produce object for a specific Navigation Criteria.
Example: Adding a Secondary Object to a Co-produce Object with Inline Navigation Criteria
This example shows you how to add a Part as Secondary object to a Co-produce object with inline Navigation Criteria. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddCoproduceMembersWithInlineNavCriteria
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:199424"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:199349"
}
]
}
],
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplicationName": null,
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartEffectivityDateConfigSpec",
"EffectiveDate": "2022-03-09T23:00:00Z",
"EffectiveContext": "wt.part.WTPartMaster:203145",
"View": "Design",
"Variation1": null,
"Variation2": null
}
],
"Filters": [],
"HideUnresolvedDependents": false,
"SharedToAll": true,
"UseDefaultForUnresolved": false
}
}
Similarly, you can add a Made From Set as Secondary object to the Co-produce object with inline Navigation Criteria.
Example: Adding a Secondary Object to a Co-produce Object in Context of Change
This example shows you how to add a Part as Secondary object to a Co-produce object in context of a Change object specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/AddCoproduceMembers
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CoproduceSecondaryMembersAssociations": [
{
"Coproduce": {
"ID": "OR:wt.part.WTPart:217111"
},
"SecondaryMembers": [
{
"ID": "OR:wt.part.WTPart:216880"
}
]
}
],
"ChangeOid": "VR:wt.change2.WTChangeOrder2:216922"
}
Similarly, you can add a Made From Set as Secondary object to the Co-produce object in context of a Change object.
The request records the change information for the Co-produce object version whose structure is regenerated when you add new Secondary objects, in the specified Change object.