From WorldCat Developers' Network

Jump to: navigation, search

Hello WorldCat

Follow the steps in this tutorial to create a WorldCat citation-formatting application using Yahoo Pipes.

Yahoo Pipes is an easy-to-use graphical web application for combining input from various sources -- yahoo search results, xml from your applications, RSS and Atom feeds on the web -- and combine these into a single RSS Feed. Once created, the RSS Feed can be reused anywhere on the web where RSS is a good fit: on iGoogle home pages, blogs, etc.


Getting Started

To get started you'll need a Yahoo account. Then go to pipes.yahoo.com, logon, and click "Create a Pipe".

You'll see a blank canvas of grid lines. This is where the Pipes objects are dragged from the menu on the left-side of the screen, and connected.

To begin building this application, select a Pipes object to construct a URL for sending a request to the WorldCat Search API.

Initial URL Builder
Initial URL Builder

Construct a Search API URL

Open the "Url" menu, click URL Builder, and drag that over to the canvas.

URL Builder with values
URL Builder with values

Add these values to build the URL:
-- Base: http://www.worldcat.org
-- Path elements: webservices/catalog/search/worldcat/opensearch
And these Query parameters and values:
-- format: atom
-- wskey
-- cformat
-- q

http://www.worldcat.org/webservices/catalog/search/worldcat/opensearch?wskey=&q=&format=atom&cformat=

After building the URL, click on the "Refresh" link in the Debugger frame below the canvas, and you should see the URL shown here.

New Private String object
New Private String object

Supply the WSKey Value

The wskey, cformat, and q URL values are supplied to the URL builder from other sources, rather than being hard-coded. The wskey (a web service key assigned to you for the Search API) will be provided from a private string stored in the Pipes application, and the cformat (citation format) and q (search terms) values will be form elements prompted in the user interface for input.

Create a private text field by opening the String menu selection, clicking on the Private String object, and dragging that to the right of the URL Builder object.

Private String connected to URL Builder
Private String connected to URL Builder

Add your wskey string to the Private String. Then click on the little dot at the base of the Private String object and drag it to the connecting dot to the right of the wskey element in the URL Builder object.

User Inputs connected to URL Builder
User Inputs connected to URL Builder

Supply User Inputs

Add user inputs for cformat and q in a similar way. Click on the "User inputs" menu, select Text input, and drag that to the right of the URL Builder. Do this twice, once for the cformat and once for the q element. Give each a name that matches the corresponding URL Builder element, a label for the user interface, a default value if needed, and a debugging element for testing. Then connect each to the corresponding element in the URL Builder, as shown in this illustration:

Fetch Feed added
Fetch Feed added

Fetch the API Response

Now fetch the Atom feed that should be returned by the WorldCat Search API, and get its output. Open the Sources menu and drag the Fetch Feed object below the URL Builder object. Connect its URL form input to the URL Builder output as shown here:

Pipes Output connected
Pipes Output connected

Send the Output

And as a final step for building the application, drag the Pipe Output object below the Fetch Feed object (it should have been automatically added to the canvas in the previous step) and connect it to the Fetch Feed ouput.

Initial UI
Initial UI

Test the Pipe

To test the application, click the Save link, give the app a name, and then select Run Pipe. Initially you should see just the user interface:

UI with search results and citations
UI with search results and citations

But if you enter search terms and send those, you should see a result with each items formatted in the specified citation format: