【发布时间】:2014-09-24 21:33:34
【问题描述】:
我一直在尝试使用此处的开发人员指南通过 MarkLogic REST API (/v1/transactions) 创建事务:https://docs.marklogic.com/REST/POST/v1/transactions
当我尝试调用事务 REST 服务来创建新事务(我正在使用 CURL)时,我会收到以下 HTTP 响应:
curl -X POST -d "" -i --anyauth --user user:password http://localhost:7010/v1/transactions
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="public", ...
Content-type: application/xml
Server: MarkLogic
Content-Length: 211
Connection: Keep-Alive
Keep-Alive: timeout=5
HTTP/1.1 400 Bad Request
Content-type: application/xml
Server: MarkLogic
Content-Length: 316
Connection: Keep-Alive
Keep-Alive: timeout=5
<rapi:error xmlns:rapi="http://marklogic.com/rest-api">
<rapi:status-code>400</rapi:status-code><rapi:status>Bad Request</rapi:status>
<rapi:message-code>REST-INVALIDPARAM</rapi:message-code>
<rapi:message>REST-INVALIDPARAM: (err:FOER0000) Invalid parameter: could not parse transaction id </rapi:message>
</rapi:error>
有趣的是,当我在 Chrome 中使用 POSTMAN 时,我可以创建事务,但响应与预期不同(它以 200 状态和详细说明事务的 XML 响应,而不是 303 响应和“Location”标头设置为事务 ID)。
谁能帮我解释一下为什么这个 CURL 语句失败了?
干杯
【问题讨论】:
-
200 vs 303 可能是您的客户端自动跟随重定向。有时在客户端中禁用它会更容易混淆。
标签: rest transactions marklogic