Marklogic 方法不允许

Marklogic 方法不允许,marklogic,Marklogic,正在尝试将REST分机上载到ML8。错误消息为“methodnotallowed”,此错误来自cURL。这是一个405错误 这个错误对我来说不够清楚。不确定在哪里寻找解决方案。这应该是直截了当的,大多数代码是从ML网站或我的模板复制/粘贴的 卷曲 curl --anyauth --user 'thijs':'password' -X PUT -i -H "Content-type: application/vnd.marklogic-javascript" -d@"./plantinfo-ext

正在尝试将REST分机上载到ML8。错误消息为“methodnotallowed”,此错误来自cURL。这是一个405错误

这个错误对我来说不够清楚。不确定在哪里寻找解决方案。这应该是直截了当的,大多数代码是从ML网站或我的模板复制/粘贴的

卷曲

curl --anyauth --user 'thijs':'password' -X PUT -i -H "Content-type: application/vnd.marklogic-javascript" -d@"./plantinfo-ext.sjs" $URL'http://uien:8017/v1/config/resources/plantinfo?method=get'  
卷曲反应

HTTP/1.1 401 Unauthorized
Server: MarkLogic
WWW-Authenticate: Digest realm="public", qop="auth", nonce="fb8b383b56b4dba52dc", opaque="20e91abaf1b"
Content-Type: text/html; charset=utf-8
Content-Length: 209
Connection: Keep-Alive
Keep-Alive: timeout=5

HTTP/1.1 405 Method Not Allowed
Content-Type: text/html; charset=utf-8
Server: MarkLogic
Allow: DELETE, GET, HEAD, OPTIONS
Content-Length: 221
Connection: Keep-Alive
Keep-Alive: timeout=5

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>405 Method Not Allowed</title>
    <meta name="robots" content="noindex,nofollow"/>
  </head>
  <body>
    <h1>405 Method Not Allowed</h1>
  </body>
</html>
ML错误

10.8.0.6 - thijs [09/Dec/2015:14:58:23 -0500] "PUT /v1/config/resources/plantinfo?method=get HTTP/1.1" 405 221 - "curl/7.35.0"

我不确定到底是什么导致了这个错误,但是您的cURL命令看起来有点奇怪:具体来说,您的凭证周围的引号,以及实际目标URL之前的$URL变量

请尝试以下命令:

curl --anyauth --user thijs:password -X PUT -i \
  -H "Content-type: application/vnd.marklogic-javascript" \
  -d@"./plantinfo-ext.sjs" \
  'http://uien:8017/v1/config/resources/plantinfo?method=get'  

我刚刚使用了您的示例javascript文件,并使用以下命令加载了它:

curl --anyauth --user admin:admin -X PUT -i \
-H "Content-type: application/vnd.marklogic-javascript"\
--data-binary @"./test.sjs"   \
'http://localhost:8000/v1/config/resources/example'
此示例来自文档,即使使用ML8.0,也可以正常工作。为此,我创建了一个204:


我建议您在这里使用sample curl命令,如果它有效,只需重新计算它。

区别可能是-d与-data二进制。如果不作为二进制加载,换行符往往会被剥离,这意味着
//Main exports.get=get
——您的导出会被注释掉。请参见第一个示例中的注释[PUT/v1/config/resources/[name]]()是的-对不起-应该将链接放在有用且完整的位置。
curl --anyauth --user admin:admin -X PUT -i \
-H "Content-type: application/vnd.marklogic-javascript"\
--data-binary @"./test.sjs"   \
'http://localhost:8000/v1/config/resources/example'