Using the Admin Center SDK
The online administrative site that accompanies your account is nice to have, but falls short of delivering the automation you really need to integrate Admin Center accounts into your web site. After all, if you want users to register with your web site and automatically receive a sleek, new Live ID with your domain name in it, you need a way of adding users and managing accounts within your code. For this, you'll need to access the Admin Center SDK
, which comes with API documentation and samples.
Because the scope of this article is necessarily limited, refer to the SDK documentation for the full definitions of all available APIs. The Admin Center API exposes a single web service endpoint containing a flush list of public methods available for all sorts of member service administration. You can use some methods, such as CreateMember
, for direct integration with your registration process. Other methods, such as GetMemberCount
, are available for more comprehensive administration of your domains and accounts. The trick to really understanding Admin Center lies in knowing which method to use, and when.
|The Admin Center API exposes a single web service endpoint containing a flush list of public methods available for all sorts of member service administration.|
Consider a typical registration scenario. You've got a great new web site that delivers triathlon information and lets competitors enter their personal stats. Each competitor needs to register with your web site in order to access their personal stats and enter in data from each of their races. You'd like to furnish users with Live IDs so that they can also chat with one another, create blogs and connect them with their Spaces accounts, and maybe even post some flyers on Live Expo. You've already got all of the pieces you need to integrate Live ID into your authentication process, but you need to be able to automatically create Admin Center user names each time the user clicks that "register' button on your site. So the registration process really requires three distinct steps in order to integrate:
- Create an administrative session for authorized management of accounts.
- Check to see if an account name already exists.
- If available, add a new account to your Admin Center domain and activate the Live ID.
That's a good start for this article. You'll dig in by setting up a small sample application that demonstrates these tasks. This example uses a C# console application created in Visual Studio .NET 2008. Of course in the real world you'll more likely be using server code in an ASP.NET application; however, a console piece should prove sufficient for this article.
Setting up the Visual Studio .NET Console Application
You'll need to first create a Visual Studio .NET Console Application project and create a reference to the Admin Center web service endpoint.
- Open Visual Studio .NET 2008, and select the New Project option from the File menu.
|Figure 4. Create Application: Select the C# console application in Visual Studio .NET 2008.|
- Find the option for creating a C# Console Application and enter a project name of MyAdminCenterSample, as shown in Figure 4. For the purposes of simplicity, leave all other default settings alone.
- Once loaded, add a web reference to your application by right-clicking the References link in the Solution Explorer and selecting "Add Web Reference" from the pop-up menu.
- Enter the following URL in the Web Reference URL field:
- Then enter "AdminCenterAPI" as the web reference name. Your screen should look something like Figure 5.
|Figure 5. Add Web Reference: The figure shows the process of adding a web reference to the Admin Center web service endpoint.|
|Author's Note: The Admin Center service endpoint uses SSL encryption to ensure that the user data sent to the service cannot be read during transport. Click OK in response to the digital certificate pop-up to continue loading the service endpoint.
- Because you will be making calls to web classes not immediately available within the default application's scope, add the following using statements to the top of the Program.cs page:
That should be enough to begin. Bear in mind that everything you will be doing from here requires the use of a fully registered, active Admin Center account. While following along, assume that you can replace any calls made to coragi.com
or its supporting elements with your own account names and elements.