Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Store nodes in the TextGrid Repository
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