Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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.
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.
I am also having trouble with this. I use a python script to do OData POSTs.
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
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.
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.
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!
Still getting '400 {"error":{"code":null,"message":"Found unsupported object for entity type."}}'
Does it matter that the CAD is from Solidworks, not CREO?
Is it necessary to checkout the EPMDocument representing the CAD? I get the error 'Found unsupported object for entity type' when doing this checkout.
No, the CAD does not need to be checked out.
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.