Create a Document with Windchill odata Rest API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
Solved! Go to Solution.
- Labels:
-
API
-
REST Services
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is the type instantiable on type and attribute management?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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')"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you very much for that hint! It works fine with "@odata.type": "#PTC.DocMgmt.MyDocumentType".
