Introduced in Feature Pack 1

Defining URLs for recipe Atom feeds

Introduced in Feature Pack 1 In this lesson, you learn how to define the URLs for various types of recipe feeds. Each URL is an address that a client can use to request a feed for a specific noun. The two nouns used in this lesson are the Project noun and the ProjectCollection noun. You must define the feed URLs first, because in the next lesson, you need to specify certain data from the URLs in the Java classes that generate the feeds.

Before you begin

Read the following topics so that you have the background knowledge required to understand the lesson:

If you need a refresher on the Project service module, and the Project and ProjectCollection nouns, review Tutorial: Creating a BOD service module,

About this task

You are going to define URLs for four different recipe feeds. This way, your store has a variety of feeds available to display recipe information to customers in feed readers and widgets.
The first and second feeds contain data from the Project noun:
  • Feed 1: Contains a list of all recipes.
  • Feed 2: Contains a specific recipe, for example, the Penne Pasta Salad recipe.
The third and fourth feeds contain data from the ProjectCollection noun:
  • Feed 3: Contains a list of all recipe collections.
  • Feed 4: Contains a specific recipe collection, for example, the Delicious Foods collection.

Procedure

  1. Using the basic RESTful URL structure you read about in URL structure for Web service feeds, define the URLs for Feed 1 and Feed 2, which both contain data from the Project noun:
    • The URL for Feed 1 is:
      http://host_name/wcs/resources/stores/storeId/Projects?responseFormat=atom
    • The URL for Feed 2 is:
      http://host_name/wcs/resources/stores/storeId/Projects/projectIdentifier?responseFormat=atom
    Notes on these URLs:
    • The WebSphere Commerce convention is to use the pluralized name of the noun in the feed URL. This is why the URLs contain Projects rather than Project.
    • Notice that the two URLs are almost identical because Feed 1 and Feed 2 both contain data from the same store and the same Project noun. The only difference is that the Feed 2 URL includes projectIdentifier. By including projectIdentifier in the URL, Feed 2 will contain data from the Project noun for a specific recipe, that is, the recipe that matches the projectIdentifier value.
  2. Now define the URLs for Feed 3 and Feed 4, which contain data from the ProjectCollection noun:
    • The URL for Feed 3 is:
      http://host_name/wcs/resources/stores/storeId/ProjectCollections?responseFormat=atom
    • The URL for Feed 4 is:
      http://host_name/wcs/resources/stores/storeId/ProjectCollections/projectCollectionIdentifier?responseFormat=atom
    Notes on these URLs:
    • The WebSphere Commerce convention is to use the pluralized name of the noun in the feed URL. This is why the URLs contain ProjectCollections rather than ProjectCollection.
    • Notice that the two URLs are almost identical because both Feed 3 and Feed 4 contain data from the same store and the same ProjectCollection noun. The only difference is that the Feed 4 URL includes projectCollectionIdentifier. By including projectCollectionIdentifier in the URL, Feed 4 will contain data from the ProjectCollection noun for a specific recipe collection, that is, the recipe collection that matches the projectCollectionIdentifier value.

Results

This lesson introduced how to form URLs for feeds from specific nouns. In the next lesson, you will use data from the URLs you defined as input to the Java classes that will generate the Web service feed.