Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Manufacturing Process Management Domain > Creating Multiple MPMOperationToPartLinks
  
Creating Multiple MPMOperationToPartLinks
You can create single or multiple MPMOperationToPartLinks by specifying the consumable path OIDs, Process Plan OID, Related Assembly OID, Process Plan Navigation Criteria OID, and Related Assembly Navigation Criteria OID in the request body. To create single or multiple MPMOperationToPartLinks, you must first check out the Operation object.
You can also create MPMOperationToPartLinks for an Operation under a Standard Procedure.
* 
To obtain the consumable path links and their OIDs, you can use the GetPartStructure action on the related assembly. For example, you can obtain the consumable path links using the following URL with expand:
http://<host>:<port>/Windchill/servlet/odata/v5/ProdMgmt/Parts('OR:wt.part.WTPart:202744')/PTC.ProdMgmt.GetPartStructure?$expand=Components($select=PartId,PartUseId,PartNumber;$expand=Occurrence;$levels=max)
The URL returns the structure of the assembly along with all the components, and you can obtain the consumable path OIDs from the response.
Example: Creating Multiple MPMOperationToPartLinks for WTPartUsageLink Objects
This example shows you how to create multiple MPMOperationToPartLinks by specifying two consumable paths with one WTPartUsageLink object specified in each of the consumable paths in the request body. It also specifies the processPlanId, processPlanNavigationCriteriaId, relatedAssemblyId, and relatedAssemblyNavigationCriteriaId attributes in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/Operations('OR:com.ptc.windchill.mpml.processplan.operation.MPMOperation:274554')/PTC.MfgProcMgmt.CreateMPMOperationToPartLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"consumablePaths": [
{
"Path": [
"OR:wt.part.WTPartUsageLink:269232"
]
},
{
"Path": [
"OR:wt.part.WTPartUsageLink:269233"
]
}
],
"processPlanId": "OR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:269100",
"relatedAssemblyId": "OR:wt.part.WTPart:269196",
"processPlanNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269409",
"relatedAssemblyNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269413"
}
Example: Creating Multiple MPMOperationToPartLinks for PartUsesOccurrences
This example shows you how to create multiple MPMOperationToPartLinks by specifying two consumable paths with two PartUsesOccurrence objects specified in each of the consumable paths in the request body. It also specifies the processPlanId, processPlanNavigationCriteriaId, relatedAssemblyId, and relatedAssemblyNavigationCriteriaId attributes in the request body.. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/Operations('OR:com.ptc.windchill.mpml.processplan.operation.MPMOperation:269377')/PTC.MfgProcMgmt.CreateMPMOperationToPartLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"consumablePaths": [
{
"Path": [
"OR:wt.part.PartUsesOccurrence:269266",
"OR:wt.part.PartUsesOccurrence:269262"
]
},
{
"Path": [
"OR:wt.part.PartUsesOccurrence:269267",
"OR:wt.part.PartUsesOccurrence:269263"
]
}
],
"processPlanId": "OR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:269321",
"relatedAssemblyId": "OR:wt.part.WTPart:269196",
"processPlanNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269409",
"relatedAssemblyNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269413"
}
Example: Creating Multiple MPMOperationToPartLinks for a Standard Operation
This example shows you how to create multiple MPMOperationToPartLinks for a Standard Operation by specifying multiple WTPartUsageLink objects and an MPMOperationUsageLink object along with the processPlanId, processPlanNavigationCriteriaId, relatedAssemblyId, and relatedAssemblyNavigationCriteriaId attributes in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/Operations('OR:com.ptc.windchill.mpml.processplan.operation.MPMStandardOperation:282633')/PTC.MfgProcMgmt.CreateMPMOperationToPartLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"consumablePaths": [
{
"Path": [
"OR:wt.part.WTPartUsageLink:274299",
"OR:wt.part.WTPartUsageLink:274322"
]
},
{
"Path": [
"OR:wt.part.WTPartUsageLink:274275"
]
}
],
"processPlanId": "OR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:274356",
"relatedAssemblyId": "OR:wt.part.WTPart:274272",
"processPlanNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269409",
"relatedAssemblyNavigationCriteriaId": "OR:wt.filter.NavigationCriteria:269413",
"operationPath": {
"Path": [
"OR:com.ptc.windchill.mpml.processplan.operation.MPMOperationUsageLink:282559"
]
}
}