当前位置: 动力学知识库 > 问答 > 编程问答 >

marklogic - HOW REST API CAN USED for calling documents from another DB based

问题描述:

I have a rest instance created on 8002 port and it is using default details database etc.

I have another database and I want to see all documents available there and also I want to get specific document.

http://localhost:8002/LATEST/rest-apis/ - work fine and show database, port etc details but when I add /search?database=nuxeo I got error 400

How can I achieve this

TIA

网友答案:

The instance on port 8002 is part of management API..

For MarkLogic 8 and beyond, the idea of needing your own rest API is not needed (the HTTP rewriter takes care of this) and you can pass a parameter to set the database.

For your need above, I would be hitting the search endpoint as described here with examples: https://docs.marklogic.com/REST/GET/v1/search

Example:

http://localhost:8000/v1/search?database=nuxeo&q=*

You can then tune these results to give you just the URIS(other interesting endpoints are available as well such as the values endpoint) or transform the data in other ways.

For getting a single document, then you would use the document get endpoint (look in the same REST API docs for that one)

分享给朋友:
您可能感兴趣的文章:
随机阅读: