I'm having trouble with assembling my signature for a source_getArticles with multiple sources.
I've been following the instructions here:
http://cookbook.daylife.com/forum/multiple-input-values
But I get "Invalid API Credentials-2001" as soon as I try to use more than one source.
Here's the code (Ruby):
sources = [
"0bYNckA4Bxc6A",
"0a0F0VifAodow"
]
sources_signature = MD5.hexdigest(accesskey + sharedsecret + sources.join)
sources_url = "http://freeapi.daylife.com/xmlrest/publicapi/4.4/source_getArticles?accesskey=#{accesskey}&signature=#{sources_signature}#{sources.map{|s| "&source_id=#{s}"}}&limit=2"
The string being passed into my signature generator is:
0bYNckA4Bxc6A0a0F0VifAodow
The resulting URL is:
http://freeapi.daylife.com/xmlrest/publicapi/4.4/source_getArticles?accesskey=[...]&signature=[...]&source_id=0bYNckA4Bxc6A&source_id=0a0F0VifAodow&limit=2
If I use just one source everything works as expected. What am I doing wrong?
must sort sources alphabetically
Just answered my own question... The key fact I missed was:
The core input to calculate the signature is formulated by alphabetically sorting and then concatenating all the input values.