API problem
I recently signed up for the SlideShare API and received an API key and a shared secret. When I finally got around to playing with the API, I'm getting an error indicating that there's a problem verifying my API key or shared secret.
I posted on the google group, but this list seems to be dead. I've also emailed SlideShare through the contact form on the website and I still haven't gotten any response. I tried applying for a new API key and I haven't received any response from that.
Is there somebody on this list that works for SlideShare that can help me out with this? I love your site and would love to use your API, if I could only get it to work.
Thanks,
Michael Collins
I posted on the google group, but this list seems to be dead. I've also emailed SlideShare through the contact form on the website and I still haven't gotten any response. I tried applying for a new API key and I haven't received any response from that.
Is there somebody on this list that works for SlideShare that can help me out with this? I love your site and would love to use your API, if I could only get it to work.
Thanks,
Michael Collins
1
person has this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
-
Inappropriate?Hi Michael,
I am Gaurav from Slideshare. We received your code through the feedback mail you sent. The problem is in the SHA1 hash calculation you are doing. The method you are using does not result in a correct hash calculation.
Calculate SHA1 like it's done in this sample code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Xml;
using System.Web;
using System.Security.Cryptography;
namespace ConsoleApplication1
{
class Program
{
public static string CalculateSHA1(string text, Encoding enc)
{
byte[] buffer = enc.GetBytes(text);
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
string hash = BitConverter.ToString(
cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
public static void getapi(String api_key,String shared_secret,String tags)
{
string timestamp = Convert.ToInt32(Math.Floor((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds)).ToString();
Console.Write("Timestamp:" + timestamp + "\n");
string lcUrl = "http://www.slideshare.net/api/1/get_slideshow_by_tag?api_key=" + api_key + "&ts=" + timestamp + "&hash=" + CalculateSHA1(shared_secret + timestamp, Encoding.UTF8) + "&tag=" + tags;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(lcUrl);
request.Method = "GET";
HttpWebResponse loWebResponse = (HttpWebResponse)request.GetResponse();
Encoding enc = Encoding.GetEncoding(1252);
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
string lcHtml = loResponseStream.ReadToEnd();
Console.Write(lcHtml);
loWebResponse.Close();
loResponseStream.Close();
}
static void Main(string[] args)
{
getapi("api_key","shared_secret","tag");
}
}
}
Hope this helps. Please feel free to write back to us incase of any more questions. -
Inappropriate?Very cool. I tried your sample code using my API key and it worked. Thank you for your help. I'll change my code to match your sample.
I’m happy
-
Inappropriate?In comparing my code and the code that you sent me, I'm noticing that the only difference between the end result of the two of them is that the final SHA1 hash code is being converted to lower case. My original code was outputting uppercase letters. You may want to update your documentation to indicate that.the hash code value needs to be converted to lower case.
Other than that, it looks like everything is working for me. Thank you for your help.
I’m happy
Loading Profile...




EMPLOYEE