Getting Started

In order to start successfully using the client library, you must first have a few things:
  • Your Scribd API Key
  • Your Scribd Secret Key
  • Your Scribd Publisher Id (optional, if you wish to use the Scribd.Net.Service.Slurpify() function)
  • A Scribd Developer Account (Username and password)
Set up your environment using the Scribd.Net.Service static class:

// Set up keys
Scribd.Net.Service.APIKey = "MyAPIKey";
Scribd.Net.Service.SecretKey = "MySecretKey";
Scribd.Net.Service.EnforceSigning = true;
Scribd.Net.Service.PublisherID = "MyPublisherId";  // Optional

// Set up web proxy (if needed)
Scribd.Net.Service.WebProxy = myWebProxy;

Perhaps a better alternative to including your SecretKey in the binary in string format is to convert the key to a byte array (using some utility external to the binary) and then do the following:

// Set up keys
Scribd.Net.Service.APIKey = "MyAPIKey";
Scribd.Net.Service.SecretKeyBytes = some_byte_array_that_you_calculated;

// ... continue as in the example above

This makes things slightly more secure. Detailing a more secure method is beyond the scope of this documentation.

After you've set up the Scribd.Net.Service properties, you can log in:

// Called after setting up the Scribd.Net.Service properties.
void LoginUser()
{
     // Subscribe to events
     Scribd.Net.User.LoggedIn +=new EventHandler<UserEventArgs>(User_LoggedIn);

     // Sign into the service
     bool signInResult = Scrib.Net.User.Login ("MyUsername", "MyPassword");
}

// This method is called on successful login.
static void User_LoggedIn(object sender, UserEventArgs e)
{
     Console.WriteLine("Hello, {0}!", (sender as Scribd.Net.User).Name);
}

The Model

The client library consists of several top-level objects:

Last edited Aug 10, 2010 at 11:41 PM by peterjp, version 11

Comments

No comments yet.