Marklogic Rest API for request directory

I have the following XQuery that I use to get documents for a directory.

xquery version "1.0-ml";

cts:search(fn:collection(), cts:directory-query("/Path/To/Docs/", "infinity"))

Now I need to translate this into a REST call, but I can’t crack it by following the documentation on this page.

https://docs.marklogic.com/REST/GET/v1/search

Update:

using the Jersey REST API, he tried this but got 406 errors

String query =  "{\"queries\":[ {\"directory-query\":{\"uri\":[\"/Path/to/Docs/\"]},\"infinite\":true} ]}";

String encodedQuery = URLEncoder.encode(query, "UTF-8");
WebTarget target = searchWebTarget.queryParam("structuredQuery", encodedQuery);

final Response response = target.request().get();

Any ideas?

+4
source share
2 answers

A directory constraint is a query parameter directly in the search API. NO other designations.

See the docs here: https://docs.marklogic.com/REST/GET/v1/search

+3
source

, , :

, , :

{\"queries\":[ {\"directory-query\":{\"uri\":[\"/Path/to/Docs/\"]},\"infinite\":true} ]}

"" . , - :

http://docs.marklogic.com/guide/search-dev/structured-query#id_97452

, , , , Java API, API REST. API :

https://docs.marklogic.com/javadoc/client/index.html

http://docs.marklogic.com/guide/java

+6

Source: https://habr.com/ru/post/1648751/


All Articles