WRS API "Cannot process objects checked out to another Workspace"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
WRS API "Cannot process objects checked out to another Workspace"
Running the WRS '/Windchill/servlet/odata/v5/ProdMgmt/CreateAssociations' command returns this error message:
{ "error": { "code": "Error", "message": "Cannot process objects checked out to another Workspace" } }
The part is checked out by the same user who is trying to run the API call.
Any suggestions?
The full command is:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'CSRF_NONCE: #########' -d '{"PartDocAssociations":[{"AssociationType":{"Value":"OWNER"},"RelatedPart@odata.bind":"Parts('OR:wt.part.WTPart:######')","RelatedCADDoc@odata.bind":"CADDocuments('OR:wt.epm.EPMDocument:######')"}]}' 'http://##.###.#.##/Windchill/servlet/odata/v5/ProdMgmt/CreateAssociations?$count=false'
Solved! Go to Solution.
- Labels:
-
CAD Data Mgmt
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You check out the Part first, using 'v5/ProdMgmt/Parts(\'' + oid + '\')/PTC.ProdMgmt.CheckOut'.
It returns you the fields of the Part, and the ID field gives you the OID of the checked out iteration. You need to use this new checked out OID when doing the CreateAssociations. You cannot use the original OID.
And of course, then you need to check the new iteration back in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am also having trouble with this. I use a python script to do OData POSTs.
- get a nonce using OData
- use the nonce in a POST to checkout the Part
- get another nonce (a new one is needed for each POST, I won't mention nonces again)
- POST to checkout the EPMDocument representing the CAD
- POST as above to CreateAssociations
- error returned is ..
Documentation:
WRS help page at https://support.ptc.com/help/windchill_rest_services/r2.1/en/index.html#page/windchill_rest_services/example_prodmgmnt_createAssociation.html
WRS manual, page 111 at
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
One error I have seen is " can not be checked out because it is not the latest iteration". Ok, understood, I will make sure I am using the latest iteration. Another error was because my URL included $count=false, OData does not seem to like that in POSTs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This time the error is ,"message":"Found unsupported object for entity type." It's time for some careful debugging because I thought I was linking my Part and EPMdocument correctly.
The documentation mentions 'Owner' and 'Content' links, but this is not explained well. I think you use 'Owner' to create an EPMBuildRule, and 'Content' for a link to some drawing type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am developing my python to access OData mostly by trial and error in the OData test utility at https://domain.com/Windchill/netmarkets/html/wrs/doc.html
Would appreciate better documentation on how to use ProdMgmt/CreateAssociations!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Still getting '400 {"error":{"code":null,"message":"Found unsupported object for entity type."}}'
Does it matter that the CAD is from Solidworks, not CREO?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Is it necessary to checkout the EPMDocument representing the CAD? I get the error 'Found unsupported object for entity type' when doing this checkout.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
No, the CAD does not need to be checked out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You check out the Part first, using 'v5/ProdMgmt/Parts(\'' + oid + '\')/PTC.ProdMgmt.CheckOut'.
It returns you the fields of the Part, and the ID field gives you the OID of the checked out iteration. You need to use this new checked out OID when doing the CreateAssociations. You cannot use the original OID.
And of course, then you need to check the new iteration back in.
