2

I am trying to access the delicious API and decided to start using the RestSharp library for the calls. My test code looks like this:

var client = new RestClient("https://api.del.icio.us/");
client.Authenticator = new HttpBasicAuthenticator("username", "password");            
client.UserAgent = "my_user_agent";            
var request = new RestRequest("v1/tags/get");

client.ExecuteAsync(request, response =>
{
   if (response.ResponseStatus == ResponseStatus.Error)
   {
      Dispatcher.BeginInvoke(() =>
      {
          MessageBox.Show(response.ErrorMessage);
      });
   }
   else if (response.ResponseStatus == ResponseStatus.Completed)
   {                    
      Dispatcher.BeginInvoke(() =>
      {
          MessageBox.Show(response.Content);
      });
   }
});

For this code the delicious API returns "access denied" code although my username and password used in the code are correct. I suspect that I may be doing something wrong with RestSharp as I just started using this library. Can anyone help me with the code above? What am I doing wrong?

Michael Irigoyen
  • 22,513
  • 17
  • 89
  • 131
AndreiC
  • 1,490
  • 4
  • 16
  • 34
  • any idea anyone? If I use the WebClient class and pass the Credentials as NetworkCredentials to the WebClient object the call succeeds without return "access denied". I would prefer to use RestSharp tho, so any help with understanding what I'm doing wrong is much appreciated. Thank you! – AndreiC Nov 08 '12 at 14:40

1 Answers1

0

You might have to use

client.Credentials = new NetworkCredential("username", "password");

See standard curl like access from dotnet

as to why on earth you would not allow access like any other system in the world.. dont ask me..

Community
  • 1
  • 1
nicolas
  • 9,549
  • 3
  • 39
  • 83