Re: [MarkLogic Dev General] Format of parameters passed to ReST /eval endpoint

2016-09-22 Thread David Mathei
Thanks very much, Geert!

On Thu, Sep 22, 2016 at 11:47 AM, Geert Josten 
wrote:

> Hi David,
>
> Just provide an array to the argument, and type your var accordingly..
>
> describe.xqy:
>
>
> xquery version "1.0-ml";
>
> declare variable $arg as item()* external;
>
> xdmp:describe($arg)
>
> Command-line:
>
> curl --anyauth --user admin:admin -X POST -i \
>
> -H "Content-type: application/x-www-form-urlencoded" \
>
> -H "Accept: multipart/mixed" \
>
> --data-urlencode xquery@./describe.xqy \
>
> --data-urlencode vars='{"arg":["hello","world"]}' \
>
> http://ml8-ml1:8000/LATEST/eval
>
> Output:
>
> HTTP/1.1 200 OK
>
> Server: MarkLogic 8.0-5.4
>
> Set-Cookie: TxnID=null; path=/
>
> Content-Type: multipart/mixed; boundary=fcaec4ec0e29c4bf
>
> Content-Length: 334
>
> Connection: Keep-Alive
>
> Keep-Alive: timeout=5
>
>
>
> --fcaec4ec0e29c4bf
>
> Content-Type: text/plain
>
> X-Primitive: string
>
>
> json:array(http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:json="
> http://marklogic.com/xdmp/json";>hello
> world)
>
> --fcaec4ec0e29c4bf--
>
> Cheers,
> Geert
>
> From:  on behalf of David Mathei
> 
> Reply-To: MarkLogic Developer Discussion 
> Date: Thursday, September 22, 2016 at 12:29 PM
> To: "general@developer.marklogic.com" 
> Subject: [MarkLogic Dev General] Format of parameters passed to ReST
> /eval endpoint
>
> Hello List,
>
> The form parameters one can pass to the ./eval endpoint are described here:
> https://docs.marklogic.com/guide/rest-dev/extensions#id_13936 . The spec
> looks like it is JSON, how would one pass a list or an array of values to
> one parameter here?
>
> Thanks
>
> David
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Format of parameters passed to ReST /eval endpoint

2016-09-22 Thread Geert Josten
Hi David,

Just provide an array to the argument, and type your var accordingly..

describe.xqy:


xquery version "1.0-ml";

declare variable $arg as item()* external;

xdmp:describe($arg)

Command-line:


curl --anyauth --user admin:admin -X POST -i \

-H "Content-type: application/x-www-form-urlencoded" \

-H "Accept: multipart/mixed" \

--data-urlencode xquery@./describe.xqy \

--data-urlencode vars='{"arg":["hello","world"]}' \

http://ml8-ml1:8000/LATEST/eval

Output:


HTTP/1.1 200 OK

Server: MarkLogic 8.0-5.4

Set-Cookie: TxnID=null; path=/

Content-Type: multipart/mixed; boundary=fcaec4ec0e29c4bf

Content-Length: 334

Connection: Keep-Alive

Keep-Alive: timeout=5



--fcaec4ec0e29c4bf

Content-Type: text/plain

X-Primitive: string


json:array(http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:json="http://marklogic.com/xdmp/json";>helloworld)

--fcaec4ec0e29c4bf--

Cheers,
Geert

From: 
mailto:general-boun...@developer.marklogic.com>>
 on behalf of David Mathei 
mailto:david.mat...@lambdawerk.com>>
Reply-To: MarkLogic Developer Discussion 
mailto:general@developer.marklogic.com>>
Date: Thursday, September 22, 2016 at 12:29 PM
To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" 
mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] Format of parameters passed to ReST /eval 
endpoint

Hello List,

The form parameters one can pass to the ./eval endpoint are described here:
https://docs.marklogic.com/guide/rest-dev/extensions#id_13936 . The spec looks 
like it is JSON, how would one pass a list or an array of values to one 
parameter here?

Thanks

David
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Format of parameters passed to ReST /eval endpoint

2016-09-22 Thread David Mathei
Hello List,

The form parameters one can pass to the ./eval endpoint are described here:
https://docs.marklogic.com/guide/rest-dev/extensions#id_13936 . The spec
looks like it is JSON, how would one pass a list or an array of values to
one parameter here?

Thanks

David
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general