Reading Windows Phone Marketplace content

I was excited when I found that the Marketplace content can be downloaded as standard Atom feed. If you are interested how Microsoft uses this for WP7 and what information you can get from there, read on ..

Marketplace is an application displaying Atom content. Atom is a standard that can be easily extended with custom metadata, while its compatibility with Atom feed format will remain. For this extensibility, is for example OData protocol a subset of Atom, but it can be used in any custom application with little effort.

Marketplace requests

Microsoft uses Akamai CDN for distributing the load and that’s why I guess you have to pass extra headers to the requests for Atom. The whole code for making requests looks like:

// Forming the requests
WebRequest request = HttpWebRequest.Create(
  "http://catalog.zune.net/v3.2/en-GB/clientTypes/WinMobile%207.0/"+
  "hubTypes/marketplace/hub?store=Zest&store=&store=HTC");

// Settings the headers
((HttpWebRequest)request).UserAgent = "ZDM/4.0; Windows Mobile 7.0;";
((HttpWebRequest)request).Host="catalog.zune.net";
((HttpWebRequest)request).Headers.Add("Cache-Control", "no-cache");

// Reading the response
var response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
var content = reader.ReadToEnd();

This sample code reads list of available Hub Types.

Basic structure of Marketplace

Based on the structure of the application, requests are of following types in this order:

  • Getting the Hub types
  • Getting the applications list
  • Getting the application details

Depending on the type of information you need, you need to form following requests:

// Hub Types
WebRequest request = HttpWebRequest.Create(
  "http://catalog.zune.net/v3.2/en-GB/clientTypes/WinMobile%207.0/" +
  "hubTypes/marketplace/hub?store=Zest&store=&store=HTC");

// Application list
//WebRequest request = HttpWebRequest.Create(
  "http://catalog.zune.net/v3.2/en-GB/apps?orderBy=releaseDate&chunkSize=10&"+
  "clientType=WinMobile%207.0&store=Zest&store=&store=HTC");

// Application details
//WebRequest request = HttpWebRequest.Create(
  "http://catalog.zune.net/v3.2/en-GB/apps/e56de6d9-3782-e011-986b-78e7d1fa76f8?"+
  "clientType=WinMobile%207.0&store=Zest&store=&store=HTC");

Please notice possibility of filtering the requests in Application List. For application details you need Application GUID, which you can get from Applications List.

Hub types request returns also some “Featured” applications, basically its the same Application GUID as you can get from Application List.

Getting the Hub Types response

Response should look like:

<?xml version="1.0" encoding="utf-8"?>
<a:feed xmlns:a="http://www.w3.org/2005/Atom" 
 xmlns:os="http://a9.com/-/spec/opensearch/1.1/" 
 xmlns="http://schemas.zune.net/catalog/apps/2008/02">
  <a:link rel="self" type="application/atom+xml" 
href="/v3.2/en-GB/clientTypes/WinMobile%207.0/hubTypes/
marketplace/hub?store=Zest&amp;store=&amp;store=HTC" />
  <a:updated>2011-07-05T16:45:14.629257Z</a:updated>
  <a:title type="text">marketplace-US-winMobile7</a:title>
  <a:id>marketplace-GB-WinMobile70-ALL-ALL</a:id>
  <templates>
    <template>
      <mimeType>application/uix</mimeType>
      <templateName>MarketplaceHub</templateName>
    </template>
  </templates>
  <a:entry>
    <a:link rel="alternate" type="application/atom+xml" 
href="/v3.2/en-GB/music/collection/features/08697005-97fe-4753-8c20-b4bc68dfc4f6" />
    <a:updated>2011-07-05T16:45:14.629257Z</a:updated>
    <a:title type="text">List Of Items</a:title>
    <a:id>urn:uuid:08697005-97fe-4753-8c20-b4bc68dfc4f6</a:id>
    <index>1</index>
    <link>
      <type>FeatureCollection</type>
      <target>08697005-97FE-4753-8C20-B4BC68DFC4F6</target>
    </link>
    <editorialItems>
      <editorialItem>
        <id>urn:uuid:95a33ce4-10ad-497a-9adf-35a289466762</id>
        <link>
          <type>Application</type>
          <target>e4571a02-0b87-e011-986b-78e7d1fa76f8</target>
        </link>
        <title>Angry Birds</title>
        <sequenceNumber>1</sequenceNumber>
        <image>
          <id>urn:uuid:3b32ef92-dba1-4e4f-867a-ee439349f698</id>
        </image>
        <backgroundImage>
          <id>urn:uuid:5a913f81-7e93-47e0-8c54-d58a9b723a29</id>
        </backgroundImage>
      </editorialItem> 

… XML has been cut here for better readability

Take look at the response you get. I find the most interesting Application Details data.

This response will return some metadata of the application, its price, and live URL of the application XAP package. (Try to download it from your Browser if you are interested what happens..)

Have some fun with this

3 thoughts on “Reading Windows Phone Marketplace content

  1. Thanks for the sample! I have one issue with this. I am seeing very high response times for some of the calls. Tried 10 AppGuid calls and response times were between 500 msec to 1 sec. For one or two calls it went up to 5 sec.

  2. Hi Kedar, have tried what you describe using this query:
    http://catalog.zune.net/v3.2/en-GB/apps?orderBy=releaseDate&chunkSize=100&clientType=WinMobile%207.0&store=Zest&store=&store=HTC
    to get 100 App IDs

    and my times does not vary so much, I can read 100 records in 11 secs, with Avg 0.1 sec per App requrest. Best time was 0.0280016 secs and worst 0.3270187.
    My guess is that it depends on what ID are you asking for.
    Have you tried to make that asynchronous with multiple queries at time ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s