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/processhttps://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=DaGziNTCuVsrynMx6YDP9swm59C7-6gsFKdm56BS0Aw&e='> <http:body media-type ="text/plain"> tokenizer&tagger&parser&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.demailto:celano@informatik.uni-leipzig.de E-mail: giuseppegacelano@gmail.commailto:giuseppegacelano@gmail.com Web site 1: http://www.dh.uni-leipzig.de/wo/team/https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dh.uni-2Dleipzig.de_wo_team_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=loDi_1hbkABa34MU40mPc3iOc7tHuC0cSM35UJ-BV2s&e= Web site 2: https://sites.google.com/site/giuseppegacelano/https://urldefense.proofpoint.com/v2/url?u=https-3A__sites.google.com_site_giuseppegacelano_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=zBJ8ibuViLzDyQgdQyAB8OO9l-30zOE2_Xid91jFZH8&e=
On 14 Aug 2017, at 14:11, Giuseppe Celano <celano@informatik.uni-leipzig.demailto:celano@informatik.uni-leipzig.de> wrote:
Hi,
I am accessing a RESTful API via the following command:
curl -F data=@example.txtmailto:data=@example.txt -F tokenizer= -F tagger= -F parser= http://lindat.mff.cuni.cz/services/udpipe/api/processhttps://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=DaGziNTCuVsrynMx6YDP9swm59C7-6gsFKdm56BS0Aw&e= > 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&a....https://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process-3Ftokenizer-26tagger-26parser-26data-3DD-25C4-259Bti-2520pojedou-2520k-2520babi-25C4-258Dce.-2520U-25C5-25BE-2520se-2520t-25C4-259B-25C5-25A1-25C3-25AD.&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=JsKpeHWT9fIPwq35J9JzJQekeMiJxkBjU6_1duyZkgs&e=
I have tried:
http:send-request(<http:request method='get' href='http://lindat.mff.cuni.cz/services/udpipe/api/process?tokenizer&tagger&a...https://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process-3Ftokenizer-26amp-3Btagger-26amp-3Bparser-26amp-3Bdata-3DD-25C4-259Bti-2520pojedou-2520k-2520babi-25C4-258Dce.-2520U-25C5-25BE-2520se-2520t-25C4-259B-25C5-25A1-25C3-25AD-27_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=rtjKIcEd_N_VB8XayzehrSAD34ew4ynTrog-moDSHXc&e=>)
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' href='http://lindat.mff.cuni.cz/services/udpipe/api/processhttps://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=DaGziNTCuVsrynMx6YDP9swm59C7-6gsFKdm56BS0Aw&e='> <http:body media-type ="string"> tokenizer&tagger&parser&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.demailto:celano@informatik.uni-leipzig.de E-mail: giuseppegacelano@gmail.commailto:giuseppegacelano@gmail.com Web site 1: http://www.dh.uni-leipzig.de/wo/team/https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dh.uni-2Dleipzig.de_wo_team_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=loDi_1hbkABa34MU40mPc3iOc7tHuC0cSM35UJ-BV2s&e= Web site 2: https://sites.google.com/site/giuseppegacelano/https://urldefense.proofpoint.com/v2/url?u=https-3A__sites.google.com_site_giuseppegacelano_&d=DwMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U&s=zBJ8ibuViLzDyQgdQyAB8OO9l-30zOE2_Xid91jFZH8&e=