cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when using API REST in ALFRESCO 6.2

Ander
Champ in-the-making
Champ in-the-making
Hi Community!
 
We are experiencing some issues using Alfresco REST API services (from Java).
We want to use versioning using checkOut and checkIn methods with the Alfresco REST API. In our logic, we use:


The error arises ocasionally when we execute the lock, update and unlock services on the same document, at least, 2 times in a row.

These are the responses of the services we are getting on the first lock, update and unlock proces:

1.Lock response (Status code = 200):
{"entry":{"isFile":true, ...aspectNames":["cm:versionable","cm:lockable","cm:auditable"], ..."properties":{"cm:lockType":"WRITE_LOCK","cm:lockOwner":{"id":"CONSULGDA","displayName":"CONSULGDA not null"},"cm:versionType":"MAJOR","cm:versionLabel":"1.0","cm:lockLifetime":"PERSISTENT"}}}

2.Update response (Status code = 200): 
{"entry":{"isFile":true, ..."aspectNames":["cm:versionable","cm:lockable","cm:auditable"], ... "properties":{"cm:lockType":"WRITE_LOCK","cm:lockOwner":{"id":"CONSULGDA","displayName":"CONSULGDA not null"},"cm:versionType":"MAJOR","cm:versionLabel":"2.0","cm:lockLifetime":"PERSISTENT"}}}

3.Unlock response (Status code = 200): 
{"entry":{"isFile":true, ...aspectNames":["cm:versionable","cm:auditable"], ..."properties":{"cm:versionLabel":"2.0","cm:versionType":"MAJOR"}}}

Then we execute again the Lock, Update and Unlock process on the same document, and we get the following responses:

1.Lock response (Status code = 200):
{"entry":{"isFile":true, ..."aspectNames":["cm:versionable","cm:lockable","cm:auditable"], ... "properties":{"cm:lockType":"WRITE_LOCK","cm:lockOwner":{"id":"CONSULGDA","displayName":"CONSULGDA not null"},"cm:versionType":"MAJOR","cm:versionLabel":"2.0","cm:lockLifetime":"PERSISTENT"}}}

2.Update response (Status code = 200): 
{"entry":{"isFile":true, ... aspectNames":["cm:versionable","cm:auditable"], ..."properties":{"cm:versionLabel":"3.0","cm:versionType":"MAJOR"}}}

3.Unlock response (Status code = 422): 
{"error":{"errorKey":"framework.exception.ApiDefault","statusCode":422,"briefSummary":"...Can't unlock node 15e44d29-0889-46b9-a2ab-22104157fcf0 because it isn't locked"...}}

As you can see, when we try to unlock the document, it says that it is not able to unlock the node, because it isn't already locked.
We have checked that for any reason some documents are not set as locked, even though the response from the message is that it was blocked correctly.

Is this an expected behaviour for the document versioning ?
Did it happen to you when using document versions in REST API ?
Do you know why documents are not (or do not appear) as locked in the second round ? 

Any feedback is welcome.
Thanks in advance.
0 REPLIES 0