Thanks. Using the documentation you linked to I was able to work out the correct syntax for the options file. Rather than the original file used with POST, I modified it to simply:
<options xmlns="http://marklogic.com/appservices/search"> <extract-document-data selected="include"> <extract-path>/audit/auditor</extract-path> <extract-path>/audit/date</extract-path> </extract-document-data> </options> I was then able to use it as an option with the GET command and the GET returned the expected results. While the caching issue may not be a big one, just avoiding it in the first place is a good way of preventing it from causing performance problems down the line. Thanks again. ________________________________ From: [email protected] <[email protected]> on behalf of Erik Hennum <[email protected]> Sent: Tuesday, 25 October 2016 1:05:29 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Using extract-document-data with GET and a REST endpoint Hi, Mark: You can persist an options file on the server and refer to it by name: http://docs.marklogic.com/guide/rest-dev/search#id_48838 That said, my understanding is that POST is only specified to prevent caching by HTTP intermediaries. Unless there are gateways, proxies, and so on between the client and server, I wouldn't expect that to be a big issue. Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of Mark Shanks [[email protected]] Sent: Monday, October 24, 2016 5:56 PM To: [email protected] Subject: [MarkLogic Dev General] Using extract-document-data with GET and a REST endpoint Hi, I have a REST endpoint up and can query documents so that the elements returned are limited by the following Options.xml file: <search xmlns="http://marklogic.com/appservices/search"> <qtext>test</qtext> <options xmlns="http://marklogic.com/appservices/search"> <extract-document-data selected="include"> <extract-path>/audit/auditor</extract-path> <extract-path>/audit/date</extract-path> </extract-document-data> <return-results>false</return-results> </options> </search> I call the REST endpoint using: curl --anyauth --user admin:admin -X POST -i -H "Content-type: application/xml" -H "Accept: multipart/mixed; boundary=BOUNDARY" -d @./Options.xml http://localhost:8111/LATEST/search However, am I right that this is not the best way to do it as POST requests never get cached, whereas if I used a GET cache the requests could be cached?? However, is it possible to run the above constraint using GET rather than POST? I tried setting a predefined search using something like the following: curl --anyauth --user admin:admin -T "Options.xml" -H "Content-type: application/xml" http://localhost:8111/LATEST/config/query/test However, I just get an error. Is it possible to POST the Options.xml and then use GET to actually retrieve the data? Thanks.
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
