Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Change Management Domain > Creating a Standalone Change Request with Affected Objects
  
Creating a Standalone Change Request with Affected Objects
You can create a standalone Change Request with one or more Affected Objects by providing the required attributes and the Changeables OIDs that you want to add as Affected Objects, in the request body. To create such Change Requests, you must have Create permission. You must also adhere to the “Attribute Constraints” and “Cascading Attribute Rules” as specified in the Type and Attribute Manager.
The Affected Objects that you want to add must exist and you must have Read permission to those. You can add the Affected Objects according to the defined association rules.
You can add any of the Changeables such as parts, documents, subtypes of parts, or subtypes of documents as Affected Objects.
* 
You cannot add Change Management Revision (BOM Redline) objects as Affected Objects to a Change Request. If you specify any such objects to be added as Affected Objects, the request fails and returns an error.
Example: Creating a Standalone Change Request with Multiple Affected Objects
This example shows you how to create a standalone Change Request with multiple Affected Objects. In this example, the request creates a standalone Change Request with four Changeable objects (parts, in this example) as its Affected Objects. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ChangeMgmt/ChangeRequests
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Name": "ChangeRequest with Multi Affected Object",
"Description": "ChangeRequest Description",
"DescriptionSummary": "DescriptionSummary1_demo",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:122008')",
"NonRecurringCost": "10",
"ProposedSolution": "PS",
"ProposedSolutionSummary": "PSS",
"RecurringCost": "20",
"@odata.type": "#PTC.ChangeMgmt.ChangeRequest",
"RequestPriority": {
"Value": "LOW"
},
"AffectedObjects@odata.bind": [
"Changeables('OR:wt.part.WTPart:122556')",
"Changeables('OR:wt.part.WTPart:123864')",
"Changeables('OR:wt.part.WTPart:123833')",
"Changeables('OR:wt.part.WTPart:123771')"
]
}
If you do not specify Changeable OIDs, then the request creates a standalone Change Request but does not add Affected Objects to it.
Example: Creating a Standalone Subtype of a Change Request with Multiple Affected Objects
This example shows you how to create a standalone subtype of a Change Request with multiple Affected Objects. In this example, the request creates the TestWTChangeRequest subtype of a Change Request with four Changeable objects (parts, in this example) as its Affected Objects. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ChangeMgmt/ChangeRequests
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Name": "Soft Type ChangeRequest",
"Description": "ChangeRequest Description",
"DescriptionSummary": "DescriptionSummary1_demo",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:122008')",
"NonRecurringCost": "10",
"ProposedSolution": "PS",
"ProposedSolutionSummary": "PSS",
"RecurringCost": "20",
"RequestPriority": {
"Value": "LOW"
},
"@odata.type": "#PTC.ChangeMgmt.TestWTChangeRequest",
"AffectedObjects@odata.bind": [
"Changeables('OR:wt.part.WTPart:122556')",
"Changeables('OR:wt.part.WTPart:123864')",
"Changeables('OR:wt.part.WTPart:123833')",
"Changeables('OR:wt.part.WTPart:123771')"
]
}
If you do not specify Changeable OIDs, then the request creates a standalone subtype but does not add Affected Objects to it.
Example: Creating a Standalone Subtype of a Change Request with a Model/Soft Attribute and an Affected Object
This example shows you how to create a standalone subtype of a Change Request with a soft attribute and an Affected Object specified in the request body. In this example, the request creates a standalone subtype of a Change Request with the specified soft attribute and a Changeable object (a Part, in this example) as its Affected Object. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ChangeMgmt/ChangeRequests
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Name": "Soft Type ChangeRequest",
"Description": "ChangeRequest Description",
"DescriptionSummary": "DescriptionSummary1_demo",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:122008')",
"NonRecurringCost": "10",
"ProposedSolution": "PS",
"ProposedSolutionSummary": "PSS",
"RecurringCost": "20",
"RequestPriority": {
"Value": "LOW"
},
"@odata.type": "#PTC.ChangeMgmt.TestWTChangeRequest",
"TestAttribute": "Test Soft Attribute",
"AffectedObjects@odata.bind": [
"Changeables('OR:wt.part.WTPart:122856')"
]
}