Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC BOM Transformation Domain > Creating Co-produce Objects with Relevant Links
  
Creating Co-produce Objects with Relevant Links
You can create single or multiple Co-produce objects or subtypes along with relevant links and attributes for given Primary object (Part or Made From Set) and/or Secondary object (Part or Made From Set) OIDs. You can specify modeled and other types of attributes, including IBAs such as enumerated lists. You can also choose to create Co-produce objects along with relevant links in the context of Change (Change Task or Change Notice).
You can create Co-produce objects or their subtypes by specifying one Primary object OID and one or more Secondary object OIDs in the request body. You can also create Co-produce objects without specifying Secondary object OIDs. You can also specify the Co-produce object type and Folder location in the request body. To create a Co-produce object, you must specify the Plant for which you want to create the Co-produce object.
You can create Co-produces along with the relevant links such as Primary Co-produce Link, Co-Produce Member Links, Co-produce Usage Links,
You must have Create access to the Co-produce and Modify access to the Change objects. You must reserve the Change object for Edit.
* 
To specify a Primary Part or Made From Set, you can specify only one OID of the Primary object.
To specify Secondary Part or Made From Set, you can specify one or more OIDs of the Secondary object.
If either Primary Part or Secondary Part has several Made From Sets under it, then in such a case you cannot specify the Part OIDs. You can specify only Made From Set OIDs.
To create a Co-produce object, you can specify only one Made From Set OID from a given Part as OID for Primary or Secondary Part.
If you provide both Made From Set OID and its parent Part OID for Secondary Parts, then it is considered as single input while ignoring the Part OID.
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 Primary object OID, then you cannot specify:
The same Made From Set OID as Secondary OID.
The OID of any other Made From Set under the same parent Primary Part as Secondary OID.
The OID of the same parent Primary Part as Secondary OID.
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: Creating Multiple Co-produce Objects
This example shows you how to create a Co-produce object for each of the two sets of a Primary Part object and a Secondary Part object specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"CustomAttribute": "Test1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200476')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
},
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200477')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199664')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
]
}
Example: Creating a Co-produce Object for a Primary Part Object and a Secondary Part Object
This example shows you how to create a Co-produce object for a Primary Part object and a Secondary Part object specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200476')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
]
}
Example: Creating a Co-produce Object for a Primary Part Object and Multiple Secondary Part Objects
This example shows you how to create a Co-produce object for a Primary Part object and two Secondary Part objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:224653')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:196070')",
"Parts('OR:wt.part.WTPart:196071')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
]
}
Example: Creating a Co-produce Object for a Primary Part Object and a Secondary Part Object for a Specific Navigation Criteria
This example shows you how to create a Co-produce object for a Primary Part object and a Secondary Part object with a specific Navigation Criteria specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200476')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
],
"navigationCriteriaId": "OR:wt.filter.NavigationCriteria:196730"
}
Example: Creating a Co-produce Object for a Primary Part Object and a Secondary Part Object with Inline Navigation Criteria
This example shows you how to create a Co-produce object for a Primary Part object and a Secondary Part object with inline Navigation Criteria. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduceWithInlineNavCriteria
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:198708')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:198566')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"ResultedByObjects@odata.bind": [
"ChangeItems('OR:wt.change2.WTChangeActivity2:192586')"
],
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:196247')"
}
],
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplicationName": null,
"ApplyToTopLevelObject": true,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartStandardConfigSpec",
"WorkingIncluded": true,
"View": "Plant1",
"LifeCycleState": null,
"Variation1": null,
"Variation2": null
}
],
"CreatedOn": "2022-03-26T10:30:30+05:30",
"Filters": [],
"HideUnresolvedDependents": false,
"ID": "OR:wt.filter.NavigationCriteria:196730",
"LastModified": "2022-03-26T10:30:30+05:30",
"Name": "DefaultNCForPlant1",
"SharedToAll": false,
"UseDefaultForUnresolved": false
}
}
Example: Creating a Co-produce Object for a Primary Part Object and a Secondary Part Object in Context of Change for a Specific Navigation Criteria
This example shows you how to create a Co-produce object for a Primary Part object and a Secondary Part object in context of Change for a specific Navigation Criteria. In this example, a Change Task object is specified in the request body. The request adds the created Co-produce object as a Resulting object in the specified Change object. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200476')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"ResultedByObjects@odata.bind": [
"ChangeItems('OR:wt.change2.WTChangeActivity2:196909')"
],
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
],
"navigationCriteriaId": "OR:wt.filter.NavigationCriteria:196730"
}
* 
The Navigation Criteria applied affects the structures under the Primary Parts and Secondary Parts and merges them, the result of which is displayed in the Co-produce Uses table in the BOM Transformer user interface. When NavigationCriteria and NavigationCriteriaId are not passed, the System Default Navigation Criteria is applied.
Example: Creating Multiple Co-produce Objects in Context of Change
This example shows you how to create a Co-produce object for each of the two sets of a Primary Part object and a Secondary Part object in context of Change specified in the request body. The request adds each created Co-produce object as a Resulting object in the respective Change object. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200476')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"ResultedByObjects@odata.bind": [
"ChangeItems('OR:wt.change2.WTChangeActivity2:196909')"
],
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
},
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:200477')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:199664')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"ResultedByObjects@odata.bind": [
"ChangeItems('OR:wt.change2.WTChangeActivity2:196910')"
],
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
]
}
Example: Creating a Co-produce Object for a Primary Made From Set Object and Multiple Secondary Objects
This example shows you how to create a Co-produce object for a Primary Made From Set object and a Made From Set object and Part object as Secondary objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/CreateCoproduce
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Coproduces": [
{
"Plant": "Plant1",
"PrimaryPart@odata.bind": "Parts('OR:wt.part.WTPart:218398')",
"SecondaryMembers@odata.bind": [
"Parts('OR:wt.part.WTPart:218419')",
"Parts('OR:wt.part.WTPart:199663')"
],
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:114708')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"
}
]
}