Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AdamSteffanick/8bcb816ab9bfffe6d862f601f5f044e6 to your computer and use it in GitHub Desktop.
Save AdamSteffanick/8bcb816ab9bfffe6d862f601f5f044e6 to your computer and use it in GitHub Desktop.
Oxford Dictionary API, Part III
xquery version "3.1";
declare function local:lookup-word($word as xs:string, $id as xs:string, $key as xs:string) {
let $request :=
<http:request href="https://od-api.oxforddictionaries.com/api/v1/entries/en/{$word}" method="get">
<http:header name="app_key" value="{$key}"/>
<http:header name="app_id" value="{$id}"/>
</http:request>
return http:send-request($request)
};
let $word := "person"
let $id := "###"
let $key := "###"
let $lookup-word := local:lookup-word(?, $id, $key)
for $definition at $num in $lookup-word($word)//definitions/_/fn:data()
return $num || ". " || $definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment