Last active
February 3, 2017 21:32
-
-
Save CliffordAnderson/f164230af60f367285ef36651591bb12 to your computer and use it in GitHub Desktop.
Oxford Dictionary API, Part III
This file contains hidden or 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.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 |
This file contains hidden or 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.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/wordlist/en/registers=Rare;domains=Art" 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) | |
return $lookup-word("person") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment