Commit b292314b authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

add an API to test for available images for index data

parent 5cc60823
......@@ -4,7 +4,7 @@ xquery version "3.1";
: given page.
:
: @author Mathias Göbel
: @version 1.0
: @version 1.1
: @since 2.5.6
: :)
......@@ -285,3 +285,25 @@ return
}
}
};
(:~
: Returns available image from TextGrid Repository
: @param $id the xml:id of an entity in the database
: @return an array of URIs
:)
declare
%rest:GET
%rest:path("/api/index/image/{$type}/{$id}")
%output:method("json")
%test:arg("id", "Arnoldi-Denkmal")
%test:assertTrue
function index:rendered-entity($type as xs:string, $id as xs:string)
as item()* {
let $request := <hc:request method="get" href="https://textgridlab.org/1.0/tgsearch-public/search/?q=(title:%22{$type}:{$id}%22)" />
let $tgsearch := hc:send-request($request)[2]
return
[
$tgsearch//tgmd:textgridUri/string()
]
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment