Hi, Fotios:
Thanks for clarifying. So, it sounds like the behaviour that you're seeing is
what's documented in the required row of the table here:
http://docs.marklogic.com/guide/rest-dev/documents#id_40113
Rather than what's documented in the if-match row of the header table here:
http://docs.marklogic.com/REST/PUT/v1/documents
The rationale for treating zero as an explicit create is for optional
optimistic locking. That is, when optimistic locking is required, a zero
header or missing header should both be treated as a create request. When
optimistic locking is optional, a zero header should be treated as a create
request. A missing header should succeed as a create or overwrite request.
So, a code bug, but if you make optimistic locking required and drop the header
for the create case, you won't notice the fix.
Erik Hennum
________________________________________
From: [email protected]
[[email protected]] on behalf of Fotios Tzellos
[[email protected]]
Sent: Thursday, August 22, 2013 8:49 AM
To: [email protected]
Subject: Re: [MarkLogic Dev General] If-Match usage incorrectly documented?
Hi Erik,
Yes I have enabled optimistic locking, and the behaviour is as expected
(Ie, conflict error when trying to create a document at an existing URI,
success otherwise) when I do NOT include the if-match header.
If I use the documentation-suggested technique of setting if-match to 0,
then conflicts are always returned. My question was whether this is a bug
or if the documentation is out of date. I'm mainly concerned about this
being flagged as a bug and fixed in the future, and having the rug pulled
out from under the application's feet.
>
>Message: 3
>Date: Thu, 22 Aug 2013 15:12:27 +0000
>From: Erik Hennum <[email protected]>
>Subject: Re: [MarkLogic Dev General] If-Match usage incorrectly
> documented?
>To: MarkLogic Developer Discussion <[email protected]>
>Message-ID:
> <dfdf2fd50bf5aa42adaf93ff2e3ca1850b0...@exchg10-be01.marklogic.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi, Fotios:
>
>Optimistic locking is off by default. Did you set the optimistic locking
>property for the REST server to required before making the document PUT
>request?
>
> http://docs.marklogic.com/guide/rest-dev/documents#id_40113
>
>Hoping that helps,
>
>
>Erik Hennum
>
>________________________________
>From: [email protected]
>[[email protected]] on behalf of Fotios Tzellos
>[[email protected]]
>Sent: Thursday, August 22, 2013 4:00 AM
>To: [email protected]
>Subject: [MarkLogic Dev General] If-Match usage incorrectly documented?
>
>
>I am using the REST API with If-Match headers to create documents only if
>they don't already exist at the specified URI. The documentation at
>http://docs.marklogic.com/REST/PUT/v1/documents states that putting an
>'If-Match: 0' header onto the PUT request should give this behaviour, but
>I am receiving a 412 Conflict in response. Oddly, leaving this header out
>entirely (once setting 'content-versions' to 'required') seems to result
>in the correct behaviour.
>
>So, is the documentation incorrect, or is there a big in ML?
>
>
>
>----------------------------
>
>http://www.bbc.co.uk
>This e-mail (and any attachments) is confidential and may contain
>personal views which are not the views of the BBC unless specifically
>stated.
>If you have received it in error, please delete it from your system.
>Do not use, copy or disclose the information in any way nor act in
>reliance on it and notify the sender immediately.
>Please note that the BBC monitors e-mails sent or received.
>Further communication will signify your consent to this.
-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless
specifically stated.
If you have received it in
error, please delete it from your system.
Do not use, copy or disclose the
information in any way nor act in reliance on it and notify the sender
immediately.
Please note that the BBC monitors e-mails
sent or received.
Further communication will signify your consent to
this.
-----------------------------
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general