我需要从自定义 REST 端点调用补丁方法。
我在 MarkLogic 文档中搜索并找到了此示例代码 -
function get(context, params) {
// return zero or more document nodes
};
function post(context, params, input) {
// return zero or more document nodes
};
function put(context, params, input) {
// return at most one document node
};
function deleteFunction(context, params) {
// return at most one document node
};
exports.GET = get;
exports.POST = post;
exports.PUT = put;
exports.DELETE = deleteFunction;
我目前使用所有这些 JS 扩展,它们工作得很好。我尝试以同样的方式制作补丁功能 -
function patch(context, params, input) {
return;
}
exports.PATCH = patch;
当我通过端点调用补丁方法时,收到“405 方法不允许”消息。 MarkLogic 中是否不允许以这种方式进行修补,这就是示例代码中未包含它的原因吗?
提前致谢。
最佳答案
MarkLogic自己的REST扩展机制的东西可能不支持PATCH方法,但是XQRS当然可以。
像这样
declare
%rest:PATCH
%rest:path("/my/uri/how/i/want/it")
%output:method("json")
function my-patch-request() {
object-node {
"my-key" : "my-value"
}
};
关于marklogic - MarkLogic 中是否有 PATCH 的 JavaScript 资源扩展?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56532905/