Skip to main content
6-Contributor
July 31, 2024
Solved

Create a Document with Windchill odata Rest API

  • July 31, 2024
  • 1 reply
  • 2049 views

Version: Windchill 12.1

 

Use Case: I want to create a Document with Windchil REST Services 2.5. I used the PTC Document Management Domain with POST /Documents.


Description:

By using the Body of the example from Creating a Document (ptc.com) 

 

 

 

 

{
 "Name": "TestDoc1",
 "Description": "TestDoc1_Description",
 "Title": "TestDoc1_Title",
 "Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:48788507')"
}

 

 

 

i recieve

Error: 403

{ "error": { "code": null, "message": "Windchill type is not instantiable" } }

Any ideas that can help? 

Best answer by tarik_p

@DK_9661096 Not ObjectType but wcType and it should take the full qualified name e.g. "wcType": "wt.document.MyDocumentType". 

 

If it does not work, then you should extend or customize the domain, whenever you create a soft type, it will generate its specific get endpoint but not post, so needs an extension.

1 reply

14-Alexandrite
July 31, 2024

Is the type instantiable on type and attribute management?

6-Contributor
August 1, 2024

That seems the right hint, that brings me to the next question.

The main type "Document" is not instantiable, but the subtype I want to create is instantiable. So how do i create a subtype of a document? I tried to specify the "ObjectType" that is used by exiting subdocuments but it doesn't work and results in the same error.

 

{
 "ObjectType": "MyDocumentType",
 "Name": "TestDoc1",
 "Description": "TestDoc1_Description",
 "Title": "TestDoc1_Title",
 "Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:48788507')"
}

 

tarik_p14-AlexandriteAnswer
14-Alexandrite
August 1, 2024

@DK_9661096 Not ObjectType but wcType and it should take the full qualified name e.g. "wcType": "wt.document.MyDocumentType". 

 

If it does not work, then you should extend or customize the domain, whenever you create a soft type, it will generate its specific get endpoint but not post, so needs an extension.