Creating Associations between Parts and CAD documents
You can create single or multiple associations between a part and a CAD document.
The following example demonstrates how to create an owner association between a part and a CAD document. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/CreateAssociations HTTP/1.1
Request Header
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartDocAssociations": [
{
"AssociationType": {
"Value": "OWNER"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:5248022')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5247851')"
}
]
}
Response
The created association is returned in the response:
{
"@odata.context": "$metadata#PartDocAssociations",
"value": [
{
"ID": "OR:wt.epm.build.EPMBuildRule:2248022",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "OWNER",
"Display": "Owner"
}
}
],
"@PTC.AppliedContainerContext.LocalTimeZone": "America/New_York"
}
This example demonstrates creating multiple associations between one part and three different documents.
Request Header
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"PartDocAssociations": [
{
"AssociationType": {
"Value": "OWNER"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891333')"
},
{
"AssociationType": {
"Value": "CONTRIBUTING_CONTENT"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891311')"
},
{
"AssociationType": {
"Value": "CONTENT"
},
"RelatedPart@odata.bind": "Parts('OR:wt.part.WTPart:58891420')",
"RelatedCADDoc@odata.bind": "CADDocuments('OR:wt.epm.EPMDocument:5891355')"
}
]
}
Response
The created association is returned in the response:
{
"@odata.context": "$metadata#PartDocAssociations",
"value": [
{
"ID": "OR:wt.epm.build.EPMBuildRule:5891443",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "CONTRIBUTING_CONTENT",
"Display": "Owner"
}
},
{
"ID": "OR:wt.epm.build.EPMBuildRule:5891442",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "OWNER",
"Display": "Owner"
}
},
{
"ID": "OR:wt.epm.build.EPMDescribeLink:5891444",
"AssociationType": {
"@odata.type": "#PTC.CADDocumentMgmt.AssociationTypeInfo",
"Value": "CONTENT",
"Display": "Owner"
}
}
],
"@PTC.AppliedContainerContext.LocalTimeZone": "America/New_York"
}