Created
April 1, 2016 23:30
-
-
Save sterkenburgsara-zz/b103d63eac410e2e9d67341feb9a5c9e to your computer and use it in GitHub Desktop.
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:generate-signature($api_key, $method, $text, $auth_token, $secret, $format) | |
{ | |
let $hash := $secret || "api_key" || $api_key || "auth_token" || $auth_token || "format" || $format || "method" || $method || "text" || $text | |
return xs:hexBinary(hash:md5($hash)) | |
}; | |
let $method := "flickr.photos.search" | |
let $secret := [INSERT SECRET KEY] | |
let $api_key := "ecba3714cd37e87eb8c67afd54700379" | |
let $format := "rest" | |
let $text := "David+Bowie" | |
let $auth_token := "72157664352738394-85c2b5b80502cf52" | |
let $api_sig := local:generate-signature($api_key, $method, $text, $auth_token, $secret, $format) | |
let $base-url := "https://api.flickr.com/services/rest/?" | |
(: | |
let $record := fn:doc($base-url || "format=" || $format || "&api_key=" || $api_key || "&text=" || $text || "&auth_token=" || $auth_token || "&api_sig=" || $api_sig || "&method=" || $method) :) | |
return $api_sig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment