CNET API: Quick start guide

Contents

Audience

This document is intended as a "quick start" guide for developers who want to integrate the CNET API into their websites. It assumes you are familiar with the basic concepts of APIs, XML, HTTP request methods, and the REST style of software architecture. If you require further information after reading this document, please refer to the developer's guide and the reference guide.

Getting started

To get up and running quickly with the CNET API, perform the following steps:

  1. Get your free developer key.
  2. Browse and experiment with the CNET API Dashboard, a tool that allows you to view API requests and results before you begin coding.
  3. Peruse the developer's guide and reference guide as needed. In particular, ensure you read the list of Best Practices.
  4. Integrate the desired results from the CNET API Dashboard into your site.

An overview of the CNET API

The CNET API service provides quick and convenient access to CNET's full catalog of technology products and software titles. This extensive catalog powers sites like CNET Reviews, CNET Shopper and CNET Downloads. The API provides basic product information, including product categories and pricing information, as well as product images, review URLs, editors' ratings, and more.

Using the CNET API, you can access data to create pages such as the following:

  • A list of search results related to iPods.
  • Comparison price listings for Windows Vista.
  • Product views with various types of CNET-specific data, like the Editors' Rating, the good, the bad, and the bottom line, and the Editors' Choice logo for products that have received the award.

Your Developer Key

To use the CNET API Dashboard, you must have a CNET API Developer membership. A CNET API membership is free and provides you with a unique developer key that allows access to the CNET API Dashboard.

All valid CNET API request URLs contain partTag=[yourDeveloperKey]

The CNET API dashboard

The CNET API Dashboard allows you to dynamically construct API requests using a standard web form. After you select which data to include, the dashboard provides you with the query URL that will return the desired results, as well as the actual results themselves.

You can choose to return results in XML, in JSON, or in "browsable HTML" (the latter formats a JSON result in a collapsible hierarchy and displays product images). Viewing results before coding can greatly reduce time otherwise spent debugging.

Experiment on the dashboard, ensure the results are the ones you desire, and implement the resulting request URL on your site.

Below are example request URLs and responses, in both XML and JSON formats. Each displays one product by ID, with no optional parameters submitted.

Example XML request URL

http://developer.api.cnet.com/rest/v1.0/techProduct?productId=31518214&iod=none&partTag=[yourDeveloperKey]

Example XML response

<CNETResponse version="1.0">
  <TechProduct id="31518214"
     xlink:href="http://developer.api.cnet.com/rest/v1.0/techProduct?productId=31518214&iod=offers">
     <Name>Garmin Nuvi 350</Name>
     <ImageURL width="60">

        http://i.i.com.com/cnwk.1d/sc/31518214-2-60-0.gif
     </ImageURL>
     <ImageURL width="120">
        http://i.i.com.com/cnwk.1d/sc/31518214-2-120-0.gif
     </ImageURL>
     <PriceURL>
        http://shopper.cnet.com/4014-3430_9-31518214.html?ttag=api
     </PriceURL>

     <ReviewURL>
        http://reviews.cnet.com/4505-3430_7-31518214.html
     </ReviewURL>
     <Manufacturer id="208333">
        <Name>Garmin International Inc.</Name>
     </Manufacturer>

     <SKU>010-00455-00</SKU>
     <EditorsChoice>false</EditorsChoice>
     <EditorsRating outOf="10">8.3</EditorsRating>
     <PreferredNode id="3430"/>

     <Category id="3430"
        xlink:href="http://developer.api.cnet.com/rest/v1.0/category?categoryId=3430"/>
  </TechProduct>
</CNETResponse>
   

Example JSON request URL

http://developer.api.cnet.com/rest/v1.0/techProduct?productId=31518214&iod=none&viewType=json&partTag=[yourDeveloperKey]

Example JSON response

{"CNETResponse":{
  "@version":"1.0",
  "TechProduct":{
     "@id":"31518214",
     "@xlink:href":"http:\/\/developer.api.cnet.com\/restApi\/v1.0\/techProduct?productId=31518214
                    &iod=offers",
     "Name":{"$":"Garmin Nuvi 350"},
     "ImageURL":[
        {"@width":"60",
         "$":"http:\/\/i.i.com.com\/cnwk.1d\/sc\/31518214-2-60-0.gif"},
        {"@width":"120",
         "$":"http:\/\/i.i.com.com\/cnwk.1d\/sc\/31518214-2-120-0.gif"}],
     "PriceURL":{"$":"http:\/\/shopper.cnet.com\/4014-3430_9-31518214.html?ttag=api"},
     "ReviewURL":{"$":"http:\/\/reviews.cnet.com\/4505-3430_7-31518214.html"},
     "Manufacturer":{"@id":"208333","Name":{"$":"Garmin International Inc."}},
     "SKU":{"$":"010-00455-00"},
     "EditorsChoice":{"$":"false"},
     "EditorsRating":{"@outOf":"10","$":"8.3"},
     "PreferredNode":{"@id":"3430"},
     "Category":{
        "@id":"3430",
        "@xlink:href":"http:\/\/developer.api.cnet.com\/restApi\/v1.0\/category?categoryId=3430"}
     }
  }
}