Hi, Andreas:

exists() wraps the HEAD request and returns a DocumentDescriptor, which have 
the version if optimistic locking is enabled:

https://docs.marklogic.com/javadoc/client/com/marklogic/client/document/DocumentManager.html#exists-java.lang.String-


Hoping that helps,


Erik Hennum



________________________________________
From: [email protected] 
<[email protected]> on behalf of Andreas Hubmer 
<[email protected]>
Sent: Thursday, September 28, 2017 6:40:03 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] REST-API: Optimistic Locking - Feature     
Request

Hi,

Do you know whether the Java API contains a method to perform such a HEAD 
request?

Thanks,
Andreas

2017-09-28 15:34 GMT+02:00 Erik Hennum 
<[email protected]<mailto:[email protected]>>:
Hi, Andreas:

Where a gap in the product functionality affect your ability to deliver on 
requirements, it's best to raise an issue with Support.

On the particular issue, if you don't need the document content, HEAD should 
also return the ETag timestamp for use in optimistic locking.

Of course, the HTTP request still requires a network roundtrip. Depending on 
network efficiency, it might not make that much difference.


Erik Hennum


________________________________________
From: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 on behalf of Andreas Hubmer 
<[email protected]<mailto:[email protected]>>
Sent: Thursday, September 28, 2017 5:16:47 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] REST-API: Optimistic Locking - Feature Request

Hi,

We use optimistic locking.
The document-get request returns the Etag header which we send in the If-Match 
header of a subsequent document-put request.

We have a use case where a user performs several updates (put requests) in a 
row. Currently, we have to perform a get request after each update to retrieve 
the new etag.
The request pattern looks like this:
GET
PUT, immediately followed by GET
PUT, immediately followed by GET
PUT, immediately followed by GET

The additional get requests could be avoid, if the REST API (and the Java API) 
would return the new etag in the response of the PUT request. Similarly, the 
etag of a document should be returned with the response of a POST request, 
where the server-side generates the URI 
(https://docs.marklogic.com/8.0/REST/POST/v1/documents@extension=[ext]).

Cheers,
Andreas

--
Andreas Hubmer
Senior IT Consultant

EBCONT enterprise technologies GmbH

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to