Updating Attributes of Skill
To update the attributes of an existing Skill object or its subtype, you must first check out the object.
If you perform Undo Checkout on the Skill object, the changes are rolled back. When you update the Skill object, the version of the Skill object will be iterated upon checking it in. You can specify the OID of any iteration/revision/view of the Skill 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, Stop Effectivity Propagation.
|
Example: Updating Attributes of a Skill Object
This example shows you how to update the attributes of a Skill object. Use the following PATCH URI with the request body.
URI
PATCH /Windchill/servlet/odata/MfgProcMgmt/Skills('OR:com.ptc.windchill.mpml.resource.MPMSkill:298497')
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"CustomAttribForSkill": "test",
"Usage": {
"Value": "Production"
},
"DefaultUnit": {
"Value": "kg"
},
"Description": "Skill"
}
Example: Updating Attributes of Multiple Skills
This example shows you how to update the attributes of two Skill objects specified in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateSkills
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Skills": [
{
"CustomAttribForSkill": "test",
"Usage": {
"Value": "Production"
},
"ID": "OR:com.ptc.windchill.mpml.resource.MPMSkill:298497",
"DefaultUnit": {
"Value": "kg"
},
"Description": "Skill_1"
},
{
"CustomAttribForSkill": "test",
"Usage": {
"Value": "Production"
},
"ID": "OR:com.ptc.windchill.mpml.resource.MPMSkill:298497",
"DefaultUnit": {
"Value": "kg"
},
"Description": "Skill_2"
}
]
}
Updating Skills in Context of Change
This example shows you how to update two Skills in the context of Change. In this example, one change task object is specified for each Skill object in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateSkills
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Skills": [
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMSkill:205924",
"Description": "Description",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
},
{
"ID": "OR:com.ptc.windchill.mpml.resource.MPMSkill:205948",
"Description": "Description",
"ResultedByObjects@odata.bind": [
"ChangeTasks('VR:wt.change2.WTChangeActivity2:205227')"
]
}
]
}
The request updates and adds the modified Skill object as a Resultant object to the specified Change object.