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(<json:array xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:json="http://marklogic.com/xdmp/json";><json:value>hello</json:value><json:value>world</json:value></json:array>)

--fcaec4ec0e29c4bf--

Cheers,
Geert

From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of David Mathei 
<david.mat...@lambdawerk.com<mailto:david.mat...@lambdawerk.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Thursday, September 22, 2016 at 12:29 PM
To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" 
<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

Reply via email to