Hi Giuseppe,

 

You were asking about a method other than adding to the URL. Using –F with curl uses the POST method, rather than GET. Also, “string” isn’t a recognized content-type, I think.

 

Your example might work if you changed it to use POST and text/plain:

 

 

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

href='http://lindat.mff.cuni.cz/services/udpipe/api/process'>

<http:body media-type ="text/plain">

tokenizer&amp;tagger&amp;parser&amp;data=Děti pojedou k babičce. Už se těší.

</http:body>

</http:request>)

 

Kendall

 

From: <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Giuseppe Celano <celano@informatik.uni-leipzig.de>
Date: Monday, August 14, 2017 at 8:05 AM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] HTTP module

 

Hi Andy,

 

Thanks for the help. If I pass an entire text via the url, though, I get the error message "Request-URI Too Large". 

 

Best,

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/

 

On 14 Aug 2017, at 14: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:

 

 

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/