Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Manufacturing Process Management Domain > Updating Attributes of Process Material
  
Updating Attributes of Process Material
To update the attributes of an existing Process Material object or its subtype, you must first check out the object.
If you perform Undo Checkout on the Process Material object, the changes are rolled back. When you update the Process Material object, the version of the Process Material object will be iterated upon checking it in. You can specify the OID of any iteration/revision/view of the Process Material 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, Stop Effectivity Propagation.
Example: Updating Attributes of a Process Material
This example shows you how to update the attributes of a Process Material object. Use the following PATCH URI with the request body.
URI
PATCH /Windchill/servlet/odata/MfgProcMgmt/ProcessMaterials('OR:com.ptc.windchill.mpml.resource.MPMProcessMaterial:194395')
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Description": "Changed description",
"DefaultUnit": {
"Value": "m"
},
"Source": "buy",
"Usage": {
"Value": "Quality"
},
"DimensionX": {
"Precision": 0,
"Unit": "m",
"Value": 100
},
"DimensionY": {
"Precision": 1,
"Unit": "m",
"Value": 50
},
"DimensionZ": {
"Precision": 2,
"Unit": "m",
"Value": 25
},
"CustomBoolean": false,
"CustomInteger": 12
}
Example: Updating Attributes of Multiple Process Materials
This example shows you how to update the attributes of two Process Material objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateProcessMaterials
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"ProcessMaterials": [
{
"Description": "Changed description 1.1",
"DefaultUnit": {
"Value": "m"
},
"Source": "buy",
"Usage": {
"Value": "Quality"
},
"DimensionX": {
"Precision": 0,
"Unit": "m",
"Value": 100
},
"DimensionY": {
"Precision": 1,
"Unit": "m",
"Value": 50
},
"DimensionZ": {
"Precision": 2,
"Unit": "m",
"Value": 25
},
"ID": "OR:com.ptc.windchill.mpml.resource.MPMProcessMaterial:194395"
},
{
"Description": "Changed description 1.1",
"DefaultUnit": {
"Value": "m"
},
"Source": "buy",
"Usage": {
"Value": "Quality"
},
"DimensionX": {
"Precision": 0,
"Unit": "m",
"Value": 100
},
"DimensionY": {
"Precision": 1,
"Unit": "m",
"Value": 50
},
"DimensionZ": {
"Precision": 2,
"Unit": "m",
"Value": 25
},
"ID": "OR:com.ptc.windchill.mpml.resource.MPMProcessMaterial:194408"
}
]
}
Updating Process Materials in Context of Change
This example shows you how to update two Process Materials in the context of Change. In this example, one change task object is specified for each Process Material object in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateProcessMaterials
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"ProcessMaterials": [
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMProcessMaterial:205512",
"Description": "Description1",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
},
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMProcessMaterial:205536",
"Description": "Description2",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
}
]
}
The request updates and adds the modified Process Material object as a Resultant object to the specified Change object.