Home > Articles > Web Services > XML

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

Like this article? We recommend

Posting Entries

Posting is quite trivial once we have an instance of the appropriate type of service. The Atom class has a PostBlogEntry() function that returns an instance of entryType, as shown in Listing 5.

Listing 5 Making a post.

if (service.srvType.Equals(serviceType.post))
{
    entryType entry = atom.PostBlogEntry(service.postURL,
    "InformIT Test Post", "Content for my test post", "Category");
}

entryType is the class that describes the entry. In this case it’s not needed after the post is entered, but in following examples we’ll use instances of entryType to perform updates and deletions.

The posting method takes the URL provided by the service, a title, the text of the post, and an optional category as well (which corresponds to dc:subject in Atom markup). Running the code in Listing 5 results in the example in Figure 1.

Figure 1

Figure 1 View of new entry at Blogger.

  • + Share This
  • 🔖 Save To Your Account