Hi Giuseppe,
.
You could use web:create-url to create your url [1] , although it requires parameters to have explicit values. E.g

let $target:="http://lindat.mff.cuni.cz/services/udpipe/api/process"
let $params:=map{
                       "tokenizer":0,  "tagger":0, "parser":0,
                       "data":"Děti pojedou k babičce. Už se těší"
}
return http:send-request(<http:request method='get'/>, web:create-url($target,$params))

You could change this to  read  data from a file
"data":file:read-text("example.txt"),

Regards
/Andy

[1] http://docs.basex.org/wiki/Web_Module#web:create-url

On 14 August 2017 at 13:11, Giuseppe Celano <celano@informatik.uni-leipzig.de> wrote:
Hi,

I am accessing a RESTful API via the following command:

curl -F data=@example.txt  -F tokenizer= -F tagger= -F parser= http://lindat.mff.cuni.cz/services/udpipe/api/process > example2.txt

I am wondering what the best way is to do that in BaseX. The service also has a URL syntax, as shown in the following example:

http://lindat.mff.cuni.cz/services/udpipe/api/process?tokenizer&tagger&parser&data=D%C4%9Bti%20pojedou%20k%20babi%C4%8Dce.%20U%C5%BE%20se%20t%C4%9B%C5%A1%C3%AD.  

I have tried:

http:send-request(<http:request method='get' 

and works perfectly;  but I was trying to put the body of the request in http:body, but it does not work:

http:send-request(<http:request method='get' 
<http:body media-type ="string">
tokenizer&amp;tagger&amp;parser&amp;data=Děti pojedou k babičce. Už se těší.
</http:body>
</http:request>)

I could invoke the curl command in BaseX, but maybe there is a more elegant way to send the content of the file (than adding it to the URL). Thanks.

Ciao,
Giuseppe


Universität Leipzig
Institute of Computer Science, Digital Humanities
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: celano@informatik.uni-leipzig.de
E-mail: giuseppegacelano@gmail.com
Web site 1: http://www.dh.uni-leipzig.de/wo/team/
Web site 2: https://sites.google.com/site/giuseppegacelano/