Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Product Management Domain > Updating Primary Co-produce Links
  
Updating Primary Co-produce Links
The Primary Co-produce link exists between a Primary Part version and the main part of Co-produce objects. You can update single or multiple Primary Co-produce links for a Part object in context of Change (Change Task or Change Notice). You must first reserve the Change object for Edit. You can update single or multiple Primary Co-produce links for a Part object by specifying the link OIDs and their attributes in the request body. You can update both modeled and all other types of attributes associated with the link object. This bounded action is available for Part or its subtype (excluding Manufacturing Information and Resources) objects only when Windchill MPMLink is installed.
* 
You must provide a Made From Set OID to update the Made From Set reference on the Primary Co-produce Links.
The Made From Set OID must belong to the Primary Part for which you want to update the Primary Co-produce Link.
Example: Updating Multiple Primary Co-produce Links for a Part Object in Context of Change with Inline Navigation Criteria
This example shows you how to update two Primary Co-produce links for a Part object with inline Navigation Criteria in context of Change specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:204541')/PTC.ProdMgmt.UpdatePrimaryCoproduceLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PrimaryCoproduceLinks": [
{
"ID": "OR:wt.mpm.coproduce.PrimaryCoproduceLink:205707",
"CustomAttribute1": 8,
"TestAttribute": "Test1",
"Quantity": 79,
"Unit": {
"Value": "ea",
"Display": "each"
},
"AlternateSetMaster@odata.bind": "Parts('OR:wt.part.WTPart:205405')",
"ResultedByObjects@odata.bind": [
"ChangeItems('VR:wt.change2.WTChangeActivity2:206572')"
]
},
{
"ID": "OR:wt.mpm.coproduce.PrimaryCoproduceLink:205709",
"Quantity": 8890,
"Unit": {
"Value": "2",
"Display": "each"
},
"AlternateSetMaster@odata.bind": "Parts('OR:wt.part.WTPart:205405')",
"ResultedByObjects@odata.bind": [
"ChangeItems('VR:wt.change2.WTChangeActivity2:206572')"
]
}
],
"NavigationCriteria": {
"ApplicableType": "PTC.ProdMgmt.Part",
"ApplicationName": null,
"ApplyToTopLevelObject": false,
"Centricity": false,
"ConfigSpecs": [
{
"@odata.type": "#PTC.NavCriteria.WTPartEffectivityDateConfigSpec",
"EffectiveDate": "2022-03-15T23:00:00Z",
"EffectiveContext": "wt.part.WTPartMaster:194861",
"View": "Design",
"Variation1": null,
"Variation2": null
}
],
"CreatedOn": "2022-03-22T00:25:50+01:00",
"Filters": [],
"HideUnresolvedDependents": false,
"ID": "OR:wt.filter.NavigationCriteria:207141",
"LastModified": "2022-03-22T00:25:50+01:00",
"Name": "filter",
"SharedToAll": false,
"UseDefaultForUnresolved": false
}
}
Example: Updating Multiple Primary Co-produce Links for a Part Object in Context of Change for a Specific Navigation Criteria
This example shows you how to update two Primary Co-produce links for a Part object for a specific Navigation Criteria and in context of Change specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:204541')/PTC.ProdMgmt.UpdatePrimaryCoproduceLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PrimaryCoproduceLinks": [
{
"ID": "OR:wt.mpm.coproduce.PrimaryCoproduceLink:205707",
"Quantity": 79,
"Unit": {
"Value": "ea",
"Display": "each"
},
"AlternateSetMaster@odata.bind": "Parts('OR:wt.part.WTPart:205405')",
"ResultedByObjects@odata.bind": [
"ChangeItems('VR:wt.change2.WTChangeActivity2:206572')"
]
},
{
"ID": "OR:wt.mpm.coproduce.PrimaryCoproduceLink:205709",
"Quantity": 8890,
"Unit": {
"Value": "2",
"Display": "each"
},
"AlternateSetMaster@odata.bind": "Parts('OR:wt.part.WTPart:205405')",
"ResultedByObjects@odata.bind": [
"ChangeItems('VR:wt.change2.WTChangeActivity2:206572')"
]
}
],
"navigationCriteriaId": "OR:wt.filter.NavigationCriteria:331152"
}
* 
The applied Navigation Criteria is used for resolving the Primary Part and Secondary Part structures to generate the Co-produce object structure.
URI with Expand
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:204541')/PTC.ProdMgmt.UpdatePrimaryCoproduceLinks?$expand=Primary,AlternateSetMaster