Creating a Part Substitute Link
A part substitute link exists between an existing part usage link and the main substitute part.
You can create a part substitute link by specifying the required attributes SubstituteFor, SubstitutePart, Quantity, Unit, and ReferenceDesignator in the request body when the preference Enable quantity and reference designators for substitute parts is set to Yes in the Preference Management utility in Windchill.
|
• The value of Unit must be "ea" when the value for ReferenceDesignator is specified in the request body.
• The attributes Quantity, Unit, and ReferenceDesignator cannot be passed in the request body when the preference Enable quantity and reference designators for substitute parts is set to No.
|
You can also create a part substitute link with IBA attributes by specifying the defined IBA attributes of type String in the request body.
|
To create a part substitute link, you can first retrieve a PartUsageLink OID by using the following existing API:
POST /Windchill/servlet/odata/ProdMgmt/Parts('<PartOID>')/Uses?$expand=Uses,UsedBy&$filter=Used/ID eq '<UsageOID>'
|
Example: Creating a Part Substitute Link
The following example shows you how to create a part substitute link by specifying the OID of the part usage, which is on the parent part of the part usage link, in the request URI and by specifying the part usage link OID and the substitute OID in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:238952')/Substitutes
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"SubstituteFor@odata.bind": "PartUses('OR:wt.part.WTPartUsageLink:240333')",
"SubstitutePart@odata.bind": "Parts('OR:wt.part.WTPart:196441')",
"Quantity": 1,
"Unit": {
"Value": "ea"
},
"ReferenceDesignator": "r1,r2"
}
The request creates a part substitute link between the specified part usage link and substitute and returns its details in the response.
The substitute part is added to the Substitutes table available in the Manage Replacements window of the specified part usage in Windchill.
Example: Creating a Part Substitute Link with Attributes
The following example shows you how to create a part substitute link by specifying the OID of the part usage, which is on the parent part of the part usage link, in the request URI and by specifying the part usage link OID, substitute OID, and an IBA attribute of type String in the request body.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/Parts('OR:wt.part.WTPart:238982')/Substitutes
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"SubstituteFor@odata.bind": "PartUses('OR:wt.part.WTPartUsageLink:240343')",
"SubstitutePart@odata.bind": "Parts('OR:wt.part.WTPart:196451')",
"Quantity": 1,
"Unit": {
"Value": "ea"
},
"ReferenceDesignator": "r3,r4",
"StringIBA": "TestValue"
}
The request creates a part substitute link between the specified part usage link and substitute along with the StringIBA attribute value as TestValue.
The substitute part is added to the Substitutes table available in the Manage Replacements window of the specified part usage in Windchill.