
The following tutorial explains how to create an example "Web Service" style custom data service. In this example, we create a custom data service that, given a search result's URL, queries the Yahoo! Site Explorer API and fetches two links that are closely related. Before trying this tutorial, you should be familiar with basic SearchMonkey concepts and SearchMonkey's screens for creating custom data services.
![]() |
Note |
|---|---|
In order to keep the entire example simple and self-contained, this tutorial uses input data from the Yahoo! Index. Most real custom data services of this type will rely on input parameters from outside the Yahoo! Index. |
From the main SearchMonkey Applications screen, click Create a new data service. SearchMonkey displays “Step 1: Basic Info”.

Enter a Name: "Test Site Explorer
Data Service"
For Type, click .
Enter a Description: "A test data
service for Yahoo! Search's Site Explorer. Passes in the search
result's URL and retrieves related URLs from Site Explorer's
'pageData' web service."
Even if you don't plan to share your data service, the description is still useful for private development. This is particularly true if you end up creating several applications that have similar functionality. The description should not only indicate which web service the data service calls, but what kinds of data it provides.
Read the Terms of Service if you have not done so already. Select the Terms of Service checkbox.
Click . SearchMonkey saves your changes and displays “Step 2: Inputs”.

Leave the Parent Adjunct as
"yahoo:index" and the Parent Item
(rel) as "<root>". Specify a single
Meta (property) of
"dc:identifier".
These settings specify the root-level
dc:identifier in the Yahoo!
Index. This dc:identifier is the URL of the
search result, such as http://www.hp.com. Since Site
Explorer provides a web service that returns information about URLs,
this dc:identifier should serve as a fine input
parameter for our example data service.
Click . SearchMonkey saves your changes and displays “Step 3: Test Data”.

Specify three test parameters. These values are hardcoded URLs for testing the Yahoo! Site Explorer web service.
http://www.ibm.com
http://www.apple.com
http://www.hp.com
Click . SearchMonkey saves your changes and displays “Step 4: Endpoint”.

![]() |
Note |
|---|---|
If there are any problems with the extraction code, the Preview Pane displays a bulleted list of warnings and errors. |
Enter a Webservice Endpoint of
http://search.yahooapis.com/SiteExplorerService/V1/pageData?
appid=oDjsEKHV34Gs9ihGt5Yqg8OFeB9f9czKd4xAGvRzUaN54Nw109mOzoa5SNATM.ocxoUN3X_MgQ--
&query={dc:identifier}&results=4
Make sure to paste in all lines above, with
no spaces or newlines. Site Explorer's
pageData web service requires three input
parameters:
appid, representing a Yahoo! developer appID.
An appID is a long crypted string that publicly identifies you
as a registered Yahoo! developer. Ordinarily, you would have to
acquire a
Yahoo! appID before making any Site Explorer web service
call. However, for the purposes of this tutorial, we have
provided a generic "demo" appID for you. If you already have an
appID, you can use it instead.
query, representing the URL that you want
more information about. Setting this to
{dc:identifier} parameterizes the web service call.
For each search result or set of test data, SearchMonkey
substitutes in the appropriate dc:identifier value
when calling the web service.
results, representing the number of related
URLs to return.
![]() |
Note |
|---|---|
All input parameters are urlencoded. |
Select an Output Format of Other. Remove all the contents of the textarea and replace them with the following XSLT stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:y="urn:yahoo:srch"
xsi:schemaLocation="urn:yahoo:srch http://api.search.yahoo.com/SiteExplorerService/V1/PageDataResponse.xsd">
<xsl:template match="/">
<adjunctcontainer xmlns:my="http://example.com/ns/1.0">
<adjunct id="smid:{$smid}" version="1.0">
<meta property="my:link1"> <xsl:value-of select="//y:Result[1]/y:Url"/></meta>
<meta property="my:result1"> <xsl:value-of select="//y:Result[1]/y:Title"/></meta>
<meta property="my:link2"><xsl:value-of select="//y:Result[2]/y:Url"/></meta>
<meta property="my:result2"><xsl:value-of select="//y:Result[2]/y:Title"/></meta>
</adjunct>
</adjunctcontainer>
</xsl:template>
</xsl:stylesheet>
|
Boilerplate code — "Start matching templates at the root node." |
|
Boilerplate code — Specifies the root element for
extracted data, The |
|
Specifies an |
|
Describes some data on the page. A
Note that rather than having a parent
|
|
Another |
Click Save and Refresh. SearchMonkey refreshes the Preview Pane, displaying the effects of your data service on the first test URL.

The data appears to be acceptable for both links. Both
my:links are URLs, both my:results appear
to be page titles, Finally, both results are URLs that are related
to the input URL, http://www.ibm.com. In fact, the
"best match" URL is the input URL itself, which ought to be
encouraging.
Click Input and Output to view the module's input and output XML. These links are handy for debugging your data service.
Step through the other test results and verify that the Preview Pane is displaying the expected output.
Click . SearchMonkey saves your changes and displays “Step 5: Confirmation”.

Congratulations, you are done with the tutorial! You may now click and start building a presentation application based on this data service. If you have not already done so, take a look at “Presentation Application Screens” or try out the presentation application tutorial. Otherwise, return to the Application Dashboard.