0

I have an XQuery that searches for XML documents that have a specific property value (metadata) associated with it. The query below works in the Q Console, however I need to execute it as a GET call using the REST API:

cts:search( fn:collection(), cts:properties-query(cts:element-value-query(xs:QName("type"),"executable")))

How do I convert this XQuery to a REST call that will return the same results?

2 Answers 2

2

This was resolved using the following query:

<query xmlns="http://marklogic.com/appservices/search">
<properties-fragment-query>
<value-query><element name="type" ns=""/>
    <text>executable</text>
</value-query></properties-fragment-query>
</query>

I HTTP encoded this query and appended it to the REST call like this:

http://localhost:xxxx/v1/search?structuredQuery=encoded query

Sign up to request clarification or add additional context in comments.

Comments

1

Send a GET request to the /v1/search endpoint with a structuredQuery parameter set to the HTTP encoded a JSON or XML representation of a properties fragment query containing a value query on an element. See:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.