cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Create a Document with Windchill odata Rest API

DK_9661096
5-Regular Member

Create a Document with Windchill odata Rest API

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? 

ACCEPTED SOLUTION

Accepted Solutions

@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.

View solution in original post

4 REPLIES 4

Is the type instantiable on type and attribute management?

DK_9661096
5-Regular Member
(To:tarik.wifak.p)

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')"
}

 

@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.

DK_9661096
5-Regular Member
(To:tarik.wifak.p)

Thank you very much for that hint! It works fine with "@odata.type": "#PTC.DocMgmt.MyDocumentType".

Announcements

Top Tags