Smugmug API with oAuth + .NET

dladodlado Registered Users Posts: 11 Big grins
Hi All,

I'm developing a proxy in .NET that uses Smugmug API to retreive albums data. One of the requirements is to use oAuth.

I implemented all the logic that gets the token but I'm not being able to call any methods using HttpWebRequest

I'd like to know whic URL I should use to call, for example, smugmug.albums.get. I prefare not to use JSON, I'd like to use XML-RPC as a response.

I checked this URL http://wiki.smugmug.net/display/API/show+1.2.2?method=smugmug.albums.get but I'm not understanding how I could call them.

The code looks like (finalGetUrl is the variable that has the URL I don't know what should have there):

HttpWebRequest webRequest = null;
webRequest = System.Net.
WebRequest.Create(finalGetUrl) as HttpWebRequest;
webRequest.ContentType = "text/xml";
webRequest.Method = method;
webRequest.Credentials =
CredentialCache.DefaultCredentials;
webRequest.AllowWriteStreamBuffering =
true;
webRequest.PreAuthenticate =
true;
webRequest.ServicePoint.Expect100Continue =
false;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
webRequest.Headers.Add(
"Authorization", "OAuth realm=\"http://api.smugmug.com/\",oauth_consumer_key=\"" + this.ConsumerKey + "\",oauth_token=\"" + this.Token + "\",oauth_signature_method=\"HMAC-SHA1\",oauth_signature=\"" + HttpUtility.UrlEncode(sig) + "\",oauth_timestamp=\"" + timeStamp + "\",oauth_nonce=\"" + nonce + "\",oauth_verifier=\"" + this.Verifier + "\", oauth_version=\"1.0\"");

string returned = WebResponseGet(webRequest);

Comments

Sign In or Register to comment.