mfcollins3


About me


  • mfcollins3 has started 1 topic. 2 people are following it.
  • mfcollins3 has made 2 replies.

Recent activity

Subscribe to this feed
  • problem

    mfcollins3 replied on March 20, 2008 14:34 to the problem "API problem" in SlideShare:

    mfcollins3
    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.
  • problem

    mfcollins3 replied on March 20, 2008 14:10 to the problem "API problem" in SlideShare:

    mfcollins3
    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.
  • problem

    Gaurav Gupta replied on March 20, 2008 11:05 to the problem "API problem" in SlideShare:

    Gaurav Gupta
    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.
  • problem

    mfcollins3 reported a problem in SlideShare on March 19, 2008 00:20:

    mfcollins3
    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