Skip to main content
7-Bedrock
Jan 10, 2023 4:41 PM UTC
Solved

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'

 

rleirAnswer
17-Peridot
Mar 20, 2023 10:35 PM UTC

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.

 

8 replies

17-Peridot
Mar 14, 2023 4:31 PM UTC

I am also having trouble with this. I use a python script to do OData POSTs.

  1. get a nonce using OData
  2. use the nonce in a POST to checkout the Part
  3. get another nonce (a new one is needed for each POST, I won't mention nonces again)
  4. POST to checkout the EPMDocument representing the CAD
  5. POST as above to CreateAssociations
  6. 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

https://www.ptc.com/support/-/media/support/refdocs/Windchill_REST_Services/2,-d-,3/wrs.pdf?sc_lang=en

Translate
17-Peridot
Mar 14, 2023 5:12 PM UTC

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.

Translate
17-Peridot
Mar 14, 2023 5:29 PM UTC

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. 

Translate
rleir17-PeridotAnswer
17-Peridot
Mar 20, 2023 10:35 PM UTC

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.

 

Translate