Reputation: 15094
I'm trying to delete one of several collections on a document by submitting a patch to the REST interface. It seems to succeed, but the collection remains and I can't figure out why.
This is the patch I'm trying to apply:
<rapi:patch xmlns:rapi="http://marklogic.com/rest-api">
<rapi:delete select="/rapi:metadata/rapi:collections">
<rapi:collection>http://example.com/somecollection</rapi:collection>
</rapi:delete>
</rapi:patch>
And the call to the API:
curl -u username:password -X PATCH -H "Content-Type: application/xml" -d "@./payload.xml"
"http://myserver.example.com/v1/documents?uri=/path/to/file.xml?category=metadata"
I get a response of 204 Metadata Updated
, but the collection is not deleted. I've tried also category=collections
and both, but no effect. There's no example of a patch-delete in the documentation I can find, so I'm wondering if I'm missing an attribute or something.
Upvotes: 1
Views: 30
Reputation: 15094
I had the patch syntax wrong. Target the collection being deleted in the @select
attribute
<rapi:patch xmlns:rapi="http://marklogic.com/rest-api">
<rapi:delete select="/rapi:metadata/rapi:collections/rapi:collection[./text() eq
'http://example.com/somecollection']" />
</rapi:patch>
Upvotes: 1