Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Connecting with Atomizer

The first step, of course, is connecting to the Blogger API. Through Atomizer, that’s done through the Atom class by using the static Create function. By passing to the Atom API the URL, username, password, and information about the application that’s doing the connection, you’ll be given an instance of Atom that can be used to perform the basic Atom API functions. The code looks like Listing 3.

Listing 3 Atom initialization code.

String username  = txtUsername.Text;
String password  = txtPassword.Text;
Uri   atomURI   = new Uri("https://http://www.blogger.com/atom/");

Atom  atom    = null;
generatorType generator = new generatorType();

generator.url = "http://www.informit.com";
generator.Value = "InformIT Atom API Sample via Atomizer";
generator.version = "1.0";

atom = Atom.Create(atomURI, generator, username, password);

Once you have that Atom instance, you can browse through the services available to you and actually do something. These services are logically represented as service objects, with different types equating to the various services, as shown in Listing 4.

Listing 4 Handling services.

service[] services = null;
services = atom.GetServices();

foreach(service service in services)
  System.Console.WriteLine("Service: " + service.ToString()
    + " Type: " + service.srvType);

  if (service.srvType.Equals(serviceType.post))
    //Post something
  else if (service.srvType.Equals(serviceType.feed))
    //Read/edit/delete something


In Blogger’s case, these two types of services correspond to the service.post and service.feed functions, as shown in the Atom XML in Listing 1. Let’s take a look at what we can do with each service individually through Atomizer.

  • + Share This
  • 🔖 Save To Your Account