Updating Attributes of MPMOperationToConsumableLinks
To update the out of the box (OOTB) attributes of an existing MPMOperationToConsumableLink object, you must first check out the Operation object with which it is associated. You can also update modeled and all other types of attributes, including IBAs such as enumerated lists.
If you perform Undo Checkout on the Operation object, the changes are rolled back. When you update the MPMOperationToConsumableLink object, the version of the associated Operation will be iterated upon checking it in. To update the MPMOperationToConsumableLink object, you must specify the link OID in the request body.
To update an attribute, you must specify the value with its valid internal name. If a constraint is applied to the attribute, you must specify the internal name of the value specified in the constraint.
If you want to clear the value of an attribute, you can specify its value as null in the request.
If you do not specify an attribute in the request body, then the attribute retains its existing value.
Example: Updating Attributes of an MPMOperationToConsumableLink Object
This example shows you how to update the attributes of an MPMOperationToConsumableLink object specified 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:401543')/PTC.MfgProcMgmt.UpdateConsumableLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"OperationToConsumableLink": [
{
"ID": "OR:com.ptc.windchill.mpml.processplan.operation.MPMOperationToConsumableLink:402000",
"UsageRate": 1,
"stepUsageRate7": 1,
"stepUsageRate4": 1,
"stepUsageRate2": 1,
"allocationNumber": "1",
"stepUsageRate5": 1,
"Description": "test",
"Quantity": 1,
"Unit": {
"Value": "kg"
},
"stepUsageRate8": 1,
"stepUsageRate1": 1,
"stepUsageRate3": 1,
"stepUsageRate6": 1,
"scheduled": true
}
]
}
Example: Updating Attributes of Multiple MPMOperationToConsumableLink Objects
This example shows you how to update the attributes of two MPMOperationToConsumableLink objects specified 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:401543')/PTC.MfgProcMgmt.UpdateConsumableLinks
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"OperationToConsumableLink": [
{
"ID": "OR:com.ptc.windchill.mpml.processplan.operation.MPMOperationToConsumableLink:402000",
"UsageRate": 1,
"stepUsageRate7": 1,
"stepUsageRate4": 1,
"stepUsageRate2": 1,
"allocationNumber": "1",
"stepUsageRate5": 1,
"Description": "test",
"Quantity": 1,
"Unit": {
"Value": "kg"
},
"stepUsageRate8": 1,
"stepUsageRate1": 1,
"stepUsageRate3": 1,
"stepUsageRate6": 1,
"scheduled": true
},
{
"ID": "OR:com.ptc.windchill.mpml.processplan.operation.MPMOperationToConsumableLink:402003",
"UsageRate": 2,
"stepUsageRate7": 2,
"stepUsageRate4": 2,
"stepUsageRate2": 2,
"allocationNumber": "2",
"stepUsageRate5": 2,
"Description": "test2",
"Quantity": 2,
"Unit": {
"Value": "l"
},
"stepUsageRate8": 2,
"stepUsageRate1": 2,
"stepUsageRate3": 2,
"stepUsageRate6": 2,
"scheduled": false
}
]
}