Shopping Service : Accessing Yahoo's Shopping API from JavaFX

By Rakesh Menon, December 8, 2008

Shopping Service

Powered by Yahoo! Shopping

Shopping Service is a JavaFX application that search and displays
products using Yahoo! Shopping Web Services API. It can search for product offerings using text string queries.

Enter product to search
(Ex: ipod, boombox)
in text box and press
enter key or click on
button.
A list of products
matching products will
be shown. Click on
a product to view
its details.
Detailed information
of product along
with image is shown.
Use and
to scroll through list.
Click on thumbnail
will zoom the image
and will be displayed
in its default size.
Move pointer over
or click to view
product URL.
Key Bindings:
- Left Arrow
- Right Arrow
- Enter [Textbox]
- Enter Key

Don't use the api-key used in this sample. Obtain your own key from http://developer.yahoo.com/shopping/

The response contains an XML document that has a list of products including the following information about each one:

  1. Url
  2. ProductName
  3. PriceFrom
  4. PriceTo
  5. Thumbnail
  6. Description
  7. UserRating
  8. Summmary

At the top of the Main.fx file, a constant appid is declared that is initialized with value returned by FX argument "yahoo_appid". Go to http://developer.yahoo.com/shopping/ to register and receive the App ID. Use the App ID to initialize the constant appid before running the program. The App ID can be passed as argument to application.

Source Code
  // appid from http://developer.yahoo.com/shopping/
  def appid = FX.getArgument("yahoo_appid");

You can also directly assign the app-id string as shown below and rebuild the application

Source Code
def appid = "<your yahoo app id>";

If you are using proxy-server for connecting to internet, please follow setup as specified in "Java Networking and Proxies".

References