What does the MarkLogic out of the box rest api return when deleting a document fails?2019 Community Moderator ElectionREST API error return good practicesWhat REST PUT/POST/DELETE calls should return by a convention?Returning RESTful response codes in PlayRESTful undeleteREST API 404: Bad URI, or Missing Resource?Setting permissions on a document using MarkLogic's REST APIDocument versioning with MarkLogic REST APIREST-API, proper HTTP status code for invalid DELETEMarkLogic v1/transactions create by REST APIWhat is the HTTP status return code for a successful DELETE statement in REST?
PTIJ: Who should I vote for? (21st Knesset Edition)
Interplanetary conflict, some disease destroys the ability to understand or appreciate music
Are ETF trackers fundamentally better than individual stocks?
Min function accepting varying number of arguments in C++17
Time travel from stationary position?
How do I hide Chekhov's Gun?
Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?
If I can solve Sudoku can I solve Travelling Salesman Problem(TSP)? If yes, how?
What are substitutions for coconut in curry?
Python if-else code style for reduced code for rounding floats
What did Alexander Pope mean by "Expletives their feeble Aid do join"?
Why Choose Less Effective Armour Types?
What's the meaning of “spike” in the context of “adrenaline spike”?
Do I need life insurance if I can cover my own funeral costs?
Use of undefined constant bloginfo
Why do passenger jet manufacturers design their planes with stall prevention systems?
My adviser wants to be the first author
Why would a flight no longer considered airworthy be redirected like this?
How to change two letters closest to a string and one letter immediately after a string using notepad++
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
How to write cleanly even if my character uses expletive language?
Define, (actually define) the "stability" and "energy" of a compound
Welcoming 2019 Pi day: How to draw the letter π?
Official degrees of earth’s rotation per day
What does the MarkLogic out of the box rest api return when deleting a document fails?
2019 Community Moderator ElectionREST API error return good practicesWhat REST PUT/POST/DELETE calls should return by a convention?Returning RESTful response codes in PlayRESTful undeleteREST API 404: Bad URI, or Missing Resource?Setting permissions on a document using MarkLogic's REST APIDocument versioning with MarkLogic REST APIREST-API, proper HTTP status code for invalid DELETEMarkLogic v1/transactions create by REST APIWhat is the HTTP status return code for a successful DELETE statement in REST?
The MarkLogic documentation gives information for a success response, but no information for a failed delete.
https://docs.marklogic.com/REST/DELETE/v1/documents
I would expect a 404 if the document doesn't exist, a 410 if it's already been deleted, or a 403 if I don't have authorization to delete the document.
From my limited testing, it seems I get a 204 if the document doesn't exist, and a 400 if I'm not authorized.
rest marklogic http-delete
add a comment |
The MarkLogic documentation gives information for a success response, but no information for a failed delete.
https://docs.marklogic.com/REST/DELETE/v1/documents
I would expect a 404 if the document doesn't exist, a 410 if it's already been deleted, or a 403 if I don't have authorization to delete the document.
From my limited testing, it seems I get a 204 if the document doesn't exist, and a 400 if I'm not authorized.
rest marklogic http-delete
add a comment |
The MarkLogic documentation gives information for a success response, but no information for a failed delete.
https://docs.marklogic.com/REST/DELETE/v1/documents
I would expect a 404 if the document doesn't exist, a 410 if it's already been deleted, or a 403 if I don't have authorization to delete the document.
From my limited testing, it seems I get a 204 if the document doesn't exist, and a 400 if I'm not authorized.
rest marklogic http-delete
The MarkLogic documentation gives information for a success response, but no information for a failed delete.
https://docs.marklogic.com/REST/DELETE/v1/documents
I would expect a 404 if the document doesn't exist, a 410 if it's already been deleted, or a 403 if I don't have authorization to delete the document.
From my limited testing, it seems I get a 204 if the document doesn't exist, and a 400 if I'm not authorized.
rest marklogic http-delete
rest marklogic http-delete
asked Mar 7 at 13:58
TravisChambersTravisChambers
141110
141110
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Some REST practioners assert the DELETE request should be idempotent. So long as the document doesn't exist after the operation finishes, the operation succeeded.
That said, recent versions of the REST API allow a check parameter on document delete requests. If check is set to "exists," the operation should throw an error if the document doesn't exist.
In passing, I don't see how the 404 and 410 cases could be distinguished, given that there's no operational state on the server.
Hoping that helps,
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a specialdeleted
collection that doesn't show up in search.
– TravisChambers
Mar 9 at 2:13
add a comment |
You could take an API-first approach and build your own great REST APIs directly on MarkLogic where you take full control over the URI Path as well as response codes and anything else for that matter with XQRS.
declare
%rest:DELETE
%rest:path("/db/$uri=.*")
%xdmp:update
function delete-doc($uri as xs:string)
if(fn:doc-available($uri)) then (
xdmp:document-delete($uri),
<rest:response>
<http:response status="410" message="Gone"/>
</rest:response>
)
else (
<rest:response>
<http:response status="404" message="Not Found"/>
</rest:response>
)
;
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045542%2fwhat-does-the-marklogic-out-of-the-box-rest-api-return-when-deleting-a-document%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Some REST practioners assert the DELETE request should be idempotent. So long as the document doesn't exist after the operation finishes, the operation succeeded.
That said, recent versions of the REST API allow a check parameter on document delete requests. If check is set to "exists," the operation should throw an error if the document doesn't exist.
In passing, I don't see how the 404 and 410 cases could be distinguished, given that there's no operational state on the server.
Hoping that helps,
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a specialdeleted
collection that doesn't show up in search.
– TravisChambers
Mar 9 at 2:13
add a comment |
Some REST practioners assert the DELETE request should be idempotent. So long as the document doesn't exist after the operation finishes, the operation succeeded.
That said, recent versions of the REST API allow a check parameter on document delete requests. If check is set to "exists," the operation should throw an error if the document doesn't exist.
In passing, I don't see how the 404 and 410 cases could be distinguished, given that there's no operational state on the server.
Hoping that helps,
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a specialdeleted
collection that doesn't show up in search.
– TravisChambers
Mar 9 at 2:13
add a comment |
Some REST practioners assert the DELETE request should be idempotent. So long as the document doesn't exist after the operation finishes, the operation succeeded.
That said, recent versions of the REST API allow a check parameter on document delete requests. If check is set to "exists," the operation should throw an error if the document doesn't exist.
In passing, I don't see how the 404 and 410 cases could be distinguished, given that there's no operational state on the server.
Hoping that helps,
Some REST practioners assert the DELETE request should be idempotent. So long as the document doesn't exist after the operation finishes, the operation succeeded.
That said, recent versions of the REST API allow a check parameter on document delete requests. If check is set to "exists," the operation should throw an error if the document doesn't exist.
In passing, I don't see how the 404 and 410 cases could be distinguished, given that there's no operational state on the server.
Hoping that helps,
answered Mar 8 at 1:24
ehennumehennum
5,44697
5,44697
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a specialdeleted
collection that doesn't show up in search.
– TravisChambers
Mar 9 at 2:13
add a comment |
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a specialdeleted
collection that doesn't show up in search.
– TravisChambers
Mar 9 at 2:13
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a special
deleted
collection that doesn't show up in search.– TravisChambers
Mar 9 at 2:13
Right. To get the 404 or 410 I would have to do some magic. Instead of deleting the item, I'd delete it's contents, but leave the resource at it's original URI, and do a read before a delete. Alternatively, and I think this is the solution I'll be opting for, I won't actually delete the document, but I'll instead add it to a special
deleted
collection that doesn't show up in search.– TravisChambers
Mar 9 at 2:13
add a comment |
You could take an API-first approach and build your own great REST APIs directly on MarkLogic where you take full control over the URI Path as well as response codes and anything else for that matter with XQRS.
declare
%rest:DELETE
%rest:path("/db/$uri=.*")
%xdmp:update
function delete-doc($uri as xs:string)
if(fn:doc-available($uri)) then (
xdmp:document-delete($uri),
<rest:response>
<http:response status="410" message="Gone"/>
</rest:response>
)
else (
<rest:response>
<http:response status="404" message="Not Found"/>
</rest:response>
)
;
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
add a comment |
You could take an API-first approach and build your own great REST APIs directly on MarkLogic where you take full control over the URI Path as well as response codes and anything else for that matter with XQRS.
declare
%rest:DELETE
%rest:path("/db/$uri=.*")
%xdmp:update
function delete-doc($uri as xs:string)
if(fn:doc-available($uri)) then (
xdmp:document-delete($uri),
<rest:response>
<http:response status="410" message="Gone"/>
</rest:response>
)
else (
<rest:response>
<http:response status="404" message="Not Found"/>
</rest:response>
)
;
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
add a comment |
You could take an API-first approach and build your own great REST APIs directly on MarkLogic where you take full control over the URI Path as well as response codes and anything else for that matter with XQRS.
declare
%rest:DELETE
%rest:path("/db/$uri=.*")
%xdmp:update
function delete-doc($uri as xs:string)
if(fn:doc-available($uri)) then (
xdmp:document-delete($uri),
<rest:response>
<http:response status="410" message="Gone"/>
</rest:response>
)
else (
<rest:response>
<http:response status="404" message="Not Found"/>
</rest:response>
)
;
You could take an API-first approach and build your own great REST APIs directly on MarkLogic where you take full control over the URI Path as well as response codes and anything else for that matter with XQRS.
declare
%rest:DELETE
%rest:path("/db/$uri=.*")
%xdmp:update
function delete-doc($uri as xs:string)
if(fn:doc-available($uri)) then (
xdmp:document-delete($uri),
<rest:response>
<http:response status="410" message="Gone"/>
</rest:response>
)
else (
<rest:response>
<http:response status="404" message="Not Found"/>
</rest:response>
)
;
answered Mar 7 at 15:38
Charles FosterCharles Foster
18914
18914
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
add a comment |
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
i see what you're saying, but how can i return a 404 not found if i don't know the document wasn't found? i get a 204 success whether the document was found or not. i am building my own rest api on top of MarkLogic's and I'm trying to find out all the possible failed responses MarkLogic might send back, as well as how I can give users of my API accurate status codes.
– TravisChambers
Mar 7 at 15:41
1
1
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
The approach I am suggesting involves building your own REST API which is directly served from MarkLogic Server itself using the XQRS framework over and above writing a Middle Tier component that interfaces with MarkLogic via MarkLogic's REST API. This approach would give you 100% control over MarkLogic as you're able to invoke any of MarkLogic's thousands of functions as well as having total control of what your REST APIs looks like. The XQRS framework allows you to build REST APIs in a manner that's similar to the very popular JAX-RS, whilst giving total freedom with the database.
– Charles Foster
Mar 7 at 15:55
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
I'm with you now. I'll consider it, but rewriting the MarkLogic out of the box REST apis is not something I want to do. Especially in xquery.
– TravisChambers
Mar 7 at 17:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045542%2fwhat-does-the-marklogic-out-of-the-box-rest-api-return-when-deleting-a-document%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown