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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

WRS API "Cannot process objects checked out to another Workspace"

TM_10200690
7-Bedrock

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'

 

ACCEPTED SOLUTION

Accepted Solutions
rleir
17-Peridot
(To:TM_10200690)

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.

 

View solution in original post

8 REPLIES 8
rleir
17-Peridot
(To:TM_10200690)

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

rleir
17-Peridot
(To:rleir)

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.

rleir
17-Peridot
(To:rleir)

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. 

rleir
17-Peridot
(To:rleir)

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!

rleir
17-Peridot
(To:rleir)

Still getting '400 {"error":{"code":null,"message":"Found unsupported object for entity type."}}'

Does it matter that the CAD is from Solidworks, not CREO?

rleir
17-Peridot
(To:rleir)

Is it necessary to checkout the EPMDocument representing the CAD? I get the error 'Found unsupported object for entity type' when doing this checkout. 

rleir
17-Peridot
(To:rleir)

No, the CAD does not need to be checked out.

rleir
17-Peridot
(To:TM_10200690)

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.

 

Announcements


Top Tags