OData URI Structure

,

A URI used by an OData consumer has up to three significant parts, as follows:

Image A service root URI

Image A resource path

Image Query string options

An example of an OData URI is http://ebayodata.cloudapp.net/Items?search=mobile&$top=5&$skip=5

The components of this URI are then broken down as follows:

Image http://ebayodata.cloudapp.net is the service root.

Image /Items is the resource path.

Image search=phone&$top=3&$skip=5 are the query string options.

If you use Internet Explorer (IE) to navigate to this URI, you should see something like Figure 27.2. The page shows real eBay items for sale. The query retrieves three items—the sixth, seventh, and eighth items from a search result set—that match the phrase phone. This was done using the query string parameters search, $top, and $skip.

Image

FIGURE 27.2 By default, IE presents the query result using its built-in feed reader.

IE has a built-in feed reader, which is enabled by default. A quick way to view the XML result is to right-click the page and select View Source. This is a nuisance when developing, however, and you may prefer to disable the feed reader instead.

To disable the feed reader within IE, complete the following steps:

1. Select the Tools menu.

2. Select the Internet Options submenu.

3. Select the Content tab.

4. Click the Settings button of the Feed and Web Slices section to present the Feed Settings dialog.

5. Uncheck the Turn on Feed Reading View option.

6. Click OK, closing all dialog boxes.

After the feed reader has been switched off, the entire XML query result can be viewed with syntax highlighting, as shown in Figure 27.3.

Image

FIGURE 27.3 Disabling the built-in feed reader allows you to view the XML.

The format of the XML is, in this case, an Atom feed. Some services are capable of supporting other formats, which can be specified using the $format query option.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.9.237