Skip to main content
4-Participant
September 16, 2024
Question

Associate WTPart with EPMDocument

  • September 16, 2024
  • 2 replies
  • 1263 views

Hi, My goal now is to create a EPMDocument in a Workspace with associated WTPart by REST APIs 
What I plant to do: 
Step1: Create a EPMDocument in Workspace

API: Windchill/servlet/rest/v1/wgm/workspaces/{workspaceId}/store
=> Done
Step2: Create a WTPart

API: Windchill/servlet/odata/ProdMgmt/Parts
=> Error here
My body:

{
    "Name":"testToday",
    "AssemblyMode": {
      "Value""separable",
      "Display""Separable"
    },
    "PhantomManufacturingPart" : false,
    "Organization@odata.bind""Groups('OR:wt.org.WTOrganization:123')",
    "Context@odata.bind""Containers('OR:wt.inf.library.WTLibrary:123')"
}
Error
{
    "error": {
        "code"null,
        "message""The wcType: com.ptc.ElectricalPart is invalid"
    }
}

Step3: Create Association

API: Windchill/servlet/rest/v1/wtparts/{WTPart}/associations/to/documents


Does anyone have faced with similar error in step2? Please help me to fix. Thank so much !

2 replies

Fadel
23-Emerald I
September 16, 2024
Buiꓘa
4-Participant
September 17, 2024

When I visit your link, it show
Note: This article 398513 is not customer visible.
Can you explain the solution in these steps in the comment.
Thank you so much

Fadel
23-Emerald I
September 17, 2024

My bad, indeed the article is PTC INTERNAL,.

The article suggest one of the below  2 options :

  1. import com.ptc.ElectricalPart type from Out-Of-The-Box Windchill into affected environment using LoadFromFile framework
  2. Delete the Windchill REST Services configuration files for Electrical Part
 
Buiꓘa
17-Peridot
September 17, 2024

Your error message applies to step 2 only, so let's look at that and ignore your other steps for a moment.

 

Look in your 'Type and Attribute Management' under Site Utilities. Have you defined com.ptc.ElectricalPart? Are you able to create a part with this type by using the Windchill 'New Part' UI?

 

In the Windchill/servlet/odata/ProdMgmt/Parts API, can you do a GET and see the com.ptc.ElectricalPart that you created?