ColdFusion integration, API validation

11 views
Skip to first unread message

Raymond Camden

unread,
Apr 25, 2008, 11:41:32 AM4/25/08
to SlideShare Developers
I'm having trouble trying to get a simple list operation working. I
always get: 1: Failed API validation

Here is the code I'm using, with fake values for key/secret of course.

<cfscript>
function GetEpochTime() {
var datetime = 0;
if (ArrayLen(Arguments) is 0) {
datetime = Now();
}
else {
if (IsDate(Arguments[1])) {
datetime = Arguments[1];
} else {
return NULL;
}
}
return DateDiff("s", "January 1 1970 00:00", datetime);
}
</cfscript>

<cfset key = "KEY">
<cfset secret = "SECRET">

<cfset ts = getEpochTime()>
<cfset thehash = hash(secret & ts,"SHA","UTF-8")>

<cfset apiurl = "http://www.slideshare.net/api/1/
get_slideshow_by_user">
<cfset apiurl &= "?
api_key=#key#&ts=#ts#&hash=#thehash#&username_for=cfjedimaster">

<cfoutput>
ts=#ts#<br>
#thehash#<br>
apiurl=#apiurl#
<hr>
</cfoutput>

<cfhttp url="#apiurl#">
<cfset result = cfhttp.filecontent>
<cftry>
<cfdump var="#xmlParse(result)#">
<cfcatch>
<cfdump var="#cfhttp#" label="FAILED TO PARSE">
</cfcatch>
</cftry>

Raymond Camden

unread,
Apr 25, 2008, 11:48:59 AM4/25/08
to SlideShare Developers
Odd - once I lowercase it all, it works fine.
Reply all
Reply to author
Forward
0 new messages