Hello,
I want to create a WTPart part object using Rest API. This is possible, but I am not able to provide a specific subtype name. I can not found any Odata for that.
Can any one help me with an example to create part of subtype using REST API ?
Solved! Go to Solution.
Hello,
add attribute to your json file, e.g "@odata.type": "#PTC.ProdMgmt.ElectricalPart",
This body work fine:
{
"@odata.context": "http://wnc_host/Windchill/servlet/odata/v3/ProdMgmt/$metadata#Parts",
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"AlternateNumber": null,
"AssemblyMode": {
"Value": "separable",
"Display": "Separable"
},
"BOMType": null,
"CabinetName": "Default",
"ChangeStatus": null,
"CheckOutStatus": "",
"CheckoutState": "Checked in",
"Comments": null,
"ConfigurableModule": {
"Value": "standard",
"Display": "No"
},
"CreatedBy": "Demo, User",
"DefaultTraceCode": {
"Value": "0",
"Display": "Untraced"
},
"DefaultUnit": {
"Value": "ea",
"Display": "each"
},
"EndItem": false,
"FolderLocation": "/Drive System",
"FolderName": null,
"GatheringPart": false,
"GeneralStatus": null,
"Latest": true,
"LifeCycleTemplateName": "Basic",
"Name": "test1",
"Number": "TEST1",
"OEMPartSourcingStatus": [],
"ObjectType": "Electrical Part",
"OrganizationReference": "{\"type\":\"text\"}",
"PhantomManufacturingPart": false,
"Revision": "A",
"ShareStatus": null,
"Source": {
"Value": "make",
"Display": "Make"
},
"State": {
"Value": "INWORK",
"Display": "In Work"
},
"Supersedes": null,
"TypeIcon": {
"Path": "http://wnc_host/Windchill/wtcore/images/part.gif",
"Tooltip": "Electrical Part"
},
"View": "Design",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:85642')"
}
Next time:
Hello,
add attribute to your json file, e.g "@odata.type": "#PTC.ProdMgmt.ElectricalPart",
This body work fine:
{
"@odata.context": "http://wnc_host/Windchill/servlet/odata/v3/ProdMgmt/$metadata#Parts",
"@odata.type": "#PTC.ProdMgmt.ElectricalPart",
"AlternateNumber": null,
"AssemblyMode": {
"Value": "separable",
"Display": "Separable"
},
"BOMType": null,
"CabinetName": "Default",
"ChangeStatus": null,
"CheckOutStatus": "",
"CheckoutState": "Checked in",
"Comments": null,
"ConfigurableModule": {
"Value": "standard",
"Display": "No"
},
"CreatedBy": "Demo, User",
"DefaultTraceCode": {
"Value": "0",
"Display": "Untraced"
},
"DefaultUnit": {
"Value": "ea",
"Display": "each"
},
"EndItem": false,
"FolderLocation": "/Drive System",
"FolderName": null,
"GatheringPart": false,
"GeneralStatus": null,
"Latest": true,
"LifeCycleTemplateName": "Basic",
"Name": "test1",
"Number": "TEST1",
"OEMPartSourcingStatus": [],
"ObjectType": "Electrical Part",
"OrganizationReference": "{\"type\":\"text\"}",
"PhantomManufacturingPart": false,
"Revision": "A",
"ShareStatus": null,
"Source": {
"Value": "make",
"Display": "Make"
},
"State": {
"Value": "INWORK",
"Display": "In Work"
},
"Supersedes": null,
"TypeIcon": {
"Path": "http://wnc_host/Windchill/wtcore/images/part.gif",
"Tooltip": "Electrical Part"
},
"View": "Design",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:85642')"
}
Next time:
Thanks @ivan_feofilov
This work fine while creating a Electrical Part, but it fails while creating a any other sub Type part.
e.g. My Sub Type name is com.globematics.REParts,
So,
"@odata.context": "http://devapp2.globematics.com/Windchill/servlet/odata/v1/ProdMgmt/$metadata#Parts",
"@odata.type": "#PTC.ProdMgmt.REParts",
but, this is not working. custom created sub types can't be used ?
Next time:
Can you try to use custom subtype WTPart format from a query?