Alexei, you mentioned REST API extensions in your original post.

If not, is it possible by storing .xqy on MarkLogic and wrapping it into a REST 
API extension and then having the client call the extension?

As noted, the answer is yes, you can build extensions with your custom XQuery. 
The benefit to this approach is that you'll get all the features of the REST 
API without additional work, and you can use extensions just to cover those 
things that the REST API doesn't already provide. Conversely, if you intend for 
the MarkLogic application server to be directly accessible to the end user, you 
might want to do your own modules instead of the REST API so that only 
specifically intended functionality is exposed. Many use a middle tier with the 
REST API to achieve that separation.

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
Cell:  +1-484-798-8720


From: Rob Szkutak <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, December 15, 2014 at 10:19 PM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] ways to execute xQuery against

Hi again,

I forgot to mention: You may also want to look at our guide to extending the 
REST API which describes a formal way to handle various HTTP methods (GET, PUT, 
POST, etc.) upon the same REST endpoint: 
https://docs.marklogic.com/guide/rest-dev/extensions

Best,

Rob

-----Original Message-----
From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Rob Szkutak
Sent: Monday, December 15, 2014 9:10 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] ways to execute xQuery against

Hi Alexei,

Yes, you can do this.

Here's the code to add to your xQuery for those particular parameters:

let $param1 := xdmp:get-request-field("param1", "default value") let $param2 := 
xdmp:get-request-field("param2", "default value")

Some full examples and more information can be found here: 
http://docs.marklogic.com/xdmp:get-request-field

Best,

Rob

-----Original Message-----
From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Alexei Betin
Sent: Monday, December 15, 2014 8:29 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [MarkLogic Dev General] ways to execute xQuery against

Thanks, Danny

Yes, this is pretty much what I am after, except is there also a way to pass 
parameters to my query?

E.g., if I did
curl http://localhost:9876/hello.xqy?param1=value1&param2=value2

Could I access the values of param's in my xQuery code?

Thanks,
Alexei Betin


-----Original Message-----
From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of 
[email protected]<mailto:[email protected]>
Sent: Monday, December 15, 2014 5:46 PM
To: [email protected]<mailto:[email protected]>
Subject: General Digest, Vol 126, Issue 34

Send General mailing list submissions to
[email protected]<mailto:[email protected]>

To subscribe or unsubscribe via the World Wide Web, visit
http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
[email protected]<mailto:[email protected]>

You can reach the person managing the list at
[email protected]<mailto:[email protected]>

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of General digest..."


Today's Topics:

   1. ways to execute xQuery against MarkLogic (Alexei Betin)
   2. Re: ways to execute xQuery against MarkLogic (Danny Sokolsky)


----------------------------------------------------------------------

Message: 1
Date: Tue, 16 Dec 2014 01:37:07 +0000
From: Alexei Betin <[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] ways to execute xQuery against
MarkLogic
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Message-ID:
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="us-ascii"

Hello,

I've been experimenting with xQuery syntax using MarkLogic Query console and 
I've been quite happy with the results so far, but now I'd like to make sure I 
understand all the options for using xQuery against MarkLogic in an client 
application:

>From documentation, one sure way to execute xQueries would be using XCC API 
>(Java or .Net) against XDBC interface, but I am a bit confused about whether 
>there're any other / language-independent options, e.g.:

Is it possible to execute xQuery directly using REST API?

If not, is it possible by storing .xqy on MarkLogic and wrapping it into a REST 
API extension and then having the client call the extension?

Is it possible to wrap xQuery into a MarkLogic (RESTful) web-service and then 
have client access the web-service then instead of passing xQuery directly? If 
so, would it be different from creating a REST API extension?

Is there a command-line xQuery client tool?

Any advice along with pointers to documentation/examples for the possible 
options is most welcome!

Thanks,

[Forward Slash]

[Elevate]

Alexei Betin

Principal Architect; Big Data
P: (817) 928-1643 | Elevate.com<http://www.elevate.com>
4150 International Plaza, Suite 300
Fort Worth, TX 76109


Privileged and Confidential. This e-mail, and any attachments thereto, is 
intended only for use by the addressee(s) named herein and may contain 
privileged and/or confidential information. If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail. 
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20141216/0f5078ce/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2470 bytes
Desc: image001.gif
Url : 
http://developer.marklogic.com/pipermail/general/attachments/20141216/0f5078ce/attachment-0002.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1623 bytes
Desc: image002.gif
Url : 
http://developer.marklogic.com/pipermail/general/attachments/20141216/0f5078ce/attachment-0003.gif

------------------------------

Message: 2
Date: Tue, 16 Dec 2014 01:46:15 +0000
From: Danny Sokolsky 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] ways to execute xQuery against
MarkLogic
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Message-ID:
<d4f697174c071d46b891b38bfc6eafa626a...@exchg10-be01.marklogic.com<mailto:d4f697174c071d46b891b38bfc6eafa626a...@exchg10-be01.marklogic.com>>
Content-Type: text/plain; charset="us-ascii"

Hi Alexei,

The most common way to evaluate xquery modules is to create an HTTP App Server, 
put the code as xqy files under the app server root, and then hit the URL with 
a browser or with a tool like curl.  For example, suppose you have an HTTP App 
Server you have set up with a root of /space/appserver, listening on port 9876.

Now create a file called /space/appserver/hello.xqy with the following content:

"hello"

Now with curl or with a browser, go to http://localhost:9876/hello.xqy

It will prompt you to authenticate, and after that you will get the response of 
the string "hello" back.

Is that what you were asking?

-Danny

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Alexei Betin
Sent: Monday, December 15, 2014 5:37 PM
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] ways to execute xQuery against MarkLogic

Hello,

I've been experimenting with xQuery syntax using MarkLogic Query console and 
I've been quite happy with the results so far, but now I'd like to make sure I 
understand all the options for using xQuery against MarkLogic in an client 
application:

>From documentation, one sure way to execute xQueries would be using XCC API 
>(Java or .Net) against XDBC interface, but I am a bit confused about whether 
>there're any other / language-independent options, e.g.:

Is it possible to execute xQuery directly using REST API?

If not, is it possible by storing .xqy on MarkLogic and wrapping it into a REST 
API extension and then having the client call the extension?

Is it possible to wrap xQuery into a MarkLogic (RESTful) web-service and then 
have client access the web-service then instead of passing xQuery directly? If 
so, would it be different from creating a REST API extension?

Is there a command-line xQuery client tool?

Any advice along with pointers to documentation/examples for the possible 
options is most welcome!

Thanks,

[Forward Slash]

[Elevate]

Alexei Betin

Principal Architect; Big Data
P: (817) 928-1643 | Elevate.com<http://www.elevate.com>
4150 International Plaza, Suite 300
Fort Worth, TX 76109


Privileged and Confidential. This e-mail, and any attachments thereto, is 
intended only for use by the addressee(s) named herein and may contain 
privileged and/or confidential information. If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail. 
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20141216/fd7bcee5/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2470 bytes
Desc: image001.gif
Url : 
http://developer.marklogic.com/pipermail/general/attachments/20141216/fd7bcee5/attachment.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1623 bytes
Desc: image002.gif
Url : 
http://developer.marklogic.com/pipermail/general/attachments/20141216/fd7bcee5/attachment-0001.gif

------------------------------

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 126, Issue 34
****************************************
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to