Created
October 7, 2016 13:23
-
-
Save mathias-goebel/10b21127a36ce526b3e9af878a2c8095 to your computer and use it in GitHub Desktop.
Store nodes in the TextGrid Repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
(: TextGrid CRUD | |
: Store nodes in the TextGrid Repository | |
: https://textgridlab.org/doc/services/submodules/tg-crud/docs/index.html#create | |
: :) | |
(: ESX-2 = productive :) | |
let $tgcrudURL := "http://textgridlab.org/1.0/tgcrud/rest/create" | |
let $sessionId := "" | |
(: TESTSERVER | |
: let $tgcrudURL := "http://textgrid-esx1.gwdg.de/1.0/tgcrud/rest/create" | |
: let $sessionId := "":) | |
let $projectId := "" | |
let $url := $tgcrudURL || "?sessionId=" || $sessionId || "&projectId=" || $projectId | |
let $objectMetadata := doc("/db/sade-projects/textgrid/data/xml/meta/16b00.xml") | |
let $objectData := doc("/db/sade-projects/textgrid/data/xml/data/16b00.xml")/tei:TEI | |
let $request := | |
<http:request method="POST" href="{$url}" http-version="1.0"> | |
<http:multipart media-type="multipart/form-data" boundary="xYzBoundaryzYx"> | |
<http:header name="Content-Disposition" value='form-data; name="tgObjectMetadata";'/> | |
<http:header name="Content-Type" value="application/xml"/> | |
<http:body media-type="text/xml">{$objectMetadata}</http:body> | |
<http:header name="Content-Disposition" value='form-data; name="tgObjectData";'/> | |
<http:header name="Content-Type" value="application/octet-stream"/> | |
<http:body media-type="application/xml">{$objectData}</http:body> | |
</http:multipart> | |
</http:request> | |
return | |
http:send-request($request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment