Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Manufacturing Process Management Domain > Updating Attributes of Work Center
  
Updating Attributes of Work Center
To update the attributes of an existing Work Center object or its subtype, you must first check out the object.
If you perform Undo Checkout on the Work Center object, the changes are rolled back. When you update the Work Center object, the version of the Work Center object will be iterated upon checking it in. You can specify the OID of any iteration/revision/view of the Work Center object or its subtype. You can update modeled and all other types of attributes, including IBAs such as enumerated lists.
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.
* 
You cannot modify the following attributes: Name, Number, Category.
Example: Updating Attributes of a Work Center Object
This example shows you how to update the attributes of a Work Center object. Use the following PATCH URI with the request body.
URI
PATCH /Windchill/servlet/odata/MfgProcMgmt/WorkCenters('OR:com.ptc.windchill.mpml.resource.MPMWorkCenter:192458')
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Description": "Description",
"Source": "make",
"External": true,
"ERPValidationCode": "K1",
"Usage": {
"Value": "Production"
},
"DefaultUnit": {
"Value": "kg"
},
"Precision": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"StandardLaborCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardLaborTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardMoveCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardMoveTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardProcessingeCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardProcessingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardSetupCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardSetupTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardQueueCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardQueueTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardWaitingCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardWaitingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardOtherCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardOtherTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"DimensionX": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionY": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionZ": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"WorkingVolumeX": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeY": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeZ": {
"Precision": 0,
"Unit": "m",
"Value": 0
}

}
Example: Updating Attributes of Multiple Work Centers
This example shows you how to update the attributes of two Work Center objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateWorkCenters
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"WorkCenters": [
{
"ID": "VR:com.ptc.windchill.mpml.resource.MPMWorkCenter:192458",
"Description": "Description",
"Source": "make",
"External": true,
"ERPValidationCode": "K1",
"Usage": {
"Value": "Production"
},
"DefaultUnit": {
"Value": "kg"
},
"Precision": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"StandardLaborCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardLaborTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardMoveCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardMoveTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardProcessingeCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardProcessingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardSetupCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardSetupTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardQueueCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardQueueTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardWaitingCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardWaitingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardOtherCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardOtherTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"DimensionX": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionY": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionZ": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"WorkingVolumeX": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeY": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeZ": {
"Precision": 0,
"Unit": "m",
"Value": 0
}
},
{
"ID": "VR:com.ptc.windchill.mpml.resource.MPMWorkCenter:192438",
"Description": "Description",
"Source": "make",
"External": true,
"ERPValidationCode": "K1",
"Usage": {
"Value": "Production"
},
"DefaultUnit": {
"Value": "kg"
},
"Precision": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"StandardLaborCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardLaborTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardMoveCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardMoveTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardProcessingeCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardProcessingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardSetupCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardSetupTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardQueueCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardQueueTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardWaitingCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardWaitingTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"StandardOtherCost": {
"Value": 2,
"Unit": "USD",
"Precision": -1
},
"StandardOtherTime": {
"Value": 1,
"Unit": "s",
"Precision": -1
},
"DimensionX": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionY": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"DimensionZ": {
"Value": 1,
"Unit": "m",
"Precision": -1
},
"WorkingVolumeX": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeY": {
"Precision": 0,
"Unit": "m",
"Value": 0
},
"WorkingVolumeZ": {
"Precision": 0,
"Unit": "m",
"Value": 0
}
}
]
}
Updating Work Centers in Context of Change
This example shows you how to update two Work Centers in the context of Change. In this example, one change task object is specified for each Work Center object in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateWorkCenters
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"WorkCenters": [
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMWorkCenter:205413",
"Description": "Description",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
},
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMWorkCenter:205458",
"Description": "Description",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
}
]
}
The request updates and adds the modified Work Center object as a Resultant object to the specified Change object.