Skip to content

Instantly share code, notes, and snippets.

@theresajayne
Created July 5, 2011 14:43
Show Gist options
  • Save theresajayne/1064961 to your computer and use it in GitHub Desktop.
Save theresajayne/1064961 to your computer and use it in GitHub Desktop.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Yahoo News Search</title><style type="text/css">
body {
font-family: sans-serif;
font-size: 0.85em;
margin: 2em 8em;
}
.method, .representation {
background-color: #eef;
padding: 1em;
}
h1 {
font-size: 2.5em;
}
h3 {
color: orange;
font-size: 1.5em;
}
h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.25em;
}
h4 {
background-color: #dde;
margin: -1em -1em 1em -1em;
padding: 0.5em;
}
h5 {
color: white;
font-size: 2.5em;
float: right;
}
h5 + h6 {
padding-top: 1em;
}
h6 {
font-size: 1.25em;
color: #99a;
}
dd p, dd ul {
margin: 0;
}
dd {
margin-bottom: 0.5em;
}
tt {
font-size: 1.2em;
}
table {
width: 80%;
margin-bottom: 0.5em;
}
th {
text-align: left;
font-weight: normal;
color: black;
border-bottom: 1px solid black;
padding: 3px 6px;
}
td {
padding: 3px 6px;
vertical-align: top;
background-color: f6f6ff;
font-size: 0.85em;
}
td p {
margin: 0px;
}
ul {
padding-left: 1.5em;
}
p + ul {
margin-top: 0em;
}
</style></head>
<body>
<h1>Yahoo News Search</h1>
<p>
The News Search service allows you to search the Internet for news stories.
</p>
<ul>
<li><a href="#resources">Resources</a></li>
<ul>
<li><a href="#d2e3">http://api.search.yahoo.com/NewsSearchService/V1/newsSearch</a></li>
</ul>
<li><a href="#representations">Representations</a></li>
<li><a href="#faults">Faults</a></li>
</ul>
<hr></hr>
<h2 id="resources">Resources</h2>
<div class="resource">
<h3 id="d2e3">http://api.search.yahoo.com/NewsSearchService/V1/newsSearch</h3>
<p>
<p>The News Search service is limited to 5,000 queries per IP address per day. See information on <a href="http://developer.yahoo.com/search/rate.html">rate limiting</a> and our <a href="http://developer.yahoo.com/usagePolicy/">Usage Policy</a> to learn about acceptable uses and how to request additional queries
</p>
<p>Sample Request Url: <a href="http://api.search.yahoo.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&amp;query=madonna&amp;results=2&amp;language=en">http://api.search.yahoo.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&amp;query=madonna&amp;results=2&amp;language=en</a></p>
</p>
<div class="method">
<h4 id="search">GET</h4>
<h5>Request</h5>
<h6>Query Parameters</h6>
<table>
<th>parameter</th>
<th>value</th>
<th>description</th>
<tr>
<td>
<p><strong>appid</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em><small> (required)</small></p>
</td>
<td>
<p>The application ID. See <a href="http://developer.yahoo.com/faq/index.html#appid">Application IDs</a> for more information.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>query</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em><small> (required)</small></p>
</td>
<td>
<p>The query to search for.</p>
</td>
</tr>
<tr>
<td>
<p><strong>type</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
<p><em>One of:</em></p>
<ul>
<li><tt>all</tt><small> (default)</small></li>
<li><tt>any</tt></li>
<li><tt>phrase</tt></li>
</ul>
</td>
<td>
<p>The kind of search to submit:</p>
<ul>
<li><em>all</em> returns results with all query terms.
</li>
<li><em>any</em> returns results with one or more of the query terms.
</li>
<li><em>phrase</em> returns results containing the query terms as a phrase.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<p><strong>results</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#int">int</a></em></p>
<p>Default: <tt>10</tt></p>
</td>
<td>
<p>The number of results to return; at most, 50.</p>
</td>
</tr>
<tr>
<td>
<p><strong>start</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#int">int</a></em></p>
<p>Default: <tt>1</tt></p>
</td>
<td>
<p>The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000.</p>
</td>
</tr>
<tr>
<td>
<p><strong>sort</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
<p><em>One of:</em></p>
<ul>
<li><tt>rank</tt><small> (default)</small></li>
<li><tt>date</tt></li>
</ul>
</td>
<td>
<p>Sort articles by relevance or most-recent.</p>
</td>
</tr>
<tr>
<td>
<p><strong>language</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
</td>
<td>
<p>The language the results are written in. <a href="http://developer.yahoo.com/search/languages.html">Supported Languages</a>. Omitting language returns results in any language.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>site</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
</td>
<td>
<p>A domain to restrict your searches to (e.g. www.yahoo.com). You may submit up to 30 values (e.g., site=www.yahoo.com&amp;site=www.cnn.com).</p>
</td>
</tr>
<tr>
<td>
<p><strong>output</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
<p><em>One of:</em></p>
<ul>
<li><tt>xml</tt><small> (default)</small></li>
<li><tt>json</tt></li>
<li><tt>php</tt></li>
</ul>
</td>
<td>
<p>The format for the output. If <em>json</em> is requested, the results will be returned in <a href="http://developer.yahoo.com/common/json.html">JSON</a> format. If <em>php</em> is requested, the results will be returned in <a href="http://developer.yahoo.com/common/phpserial.html">Serialized PHP</a> format.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>callback</strong></p>
</td>
<td>
<p><em><a href="http://www.w3.org/TR/xmlschema-2/#string">string</a></em></p>
</td>
<td>
<p>The name of the callback function to wrap around the JSON data. The following characters are allowed: A-Z a-z 0-9 . [] and
_. If output=json has not been requested, this parameter has no effect. More information on the callback can be found in the
<a href="http://developer.yahoo.com/common/json.html#callbackparam">Yahoo! Developer Network JSON Documentation</a>.
</p>
</td>
</tr>
</table>
<h5>Response</h5>
<h6>Response Representations</h6>
<dl>
<li><a href="#d2e147">News Search Result Set
(application/xml)
</a></li>
</dl>
<h6>Faults</h6>
<dl>
<li><a href="#yaError">400 - application/xml</a></li>
</dl>
</div>
</div>
<h2 id="representations">Representations</h2>
<h3 id="d2e147">News Search Result Set
(application/xml)
</h3>
<div class="representation">
<h6>XML Schema</h6>
<p><em>Source: <a href="http://api.search.yahoo.com/NewsSearchService/V1/NewsSearchResponse.xsd">http://api.search.yahoo.com/NewsSearchService/V1/NewsSearchResponse.xsd</a></em></p><pre>&lt;xs:element name="ResultSet"&gt;
&lt;xs:complexType&gt;
&lt;xs:sequence&gt;
&lt;xs:element name="Result" type="ResultType" minOccurs="0" maxOccurs="50"/&gt;
&lt;/xs:sequence&gt;
&lt;xs:attribute name="totalResultsAvailable" type="xs:integer"/&gt;
&lt;xs:attribute name="totalResultsReturned" type="xs:integer"/&gt;
&lt;xs:attribute name="firstResultPosition" type="xs:integer"/&gt;
&lt;/xs:complexType&gt;
&lt;/xs:element&gt;</pre><h6>Representation Parameters</h6>
<table>
<th>parameter</th>
<th>value</th>
<th>description</th>
<tr>
<td>
<p><strong>ResultSet</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>Contains all of the query responses. Has attributes:</p>
<ul>
<li><b>totalResultsAvailable</b>: The number of query matches in the database.
</li>
<li><b>totalResultsReturned</b>: The number of query matches returned. This may be lower than the number of results requested if there were fewer total results
available.
</li>
<li><b>firstResultPosition</b>: The position of the first result in the overall search.
</li>
</ul>
</td>
</tr>
<tr>
<td>
<p><strong>Result</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>Contains each individual response.</p>
</td>
</tr>
<tr>
<td>
<p><strong>Title</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The title of the article.</p>
</td>
</tr>
<tr>
<td>
<p><strong>Summary</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>Summary text associated with the article.</p>
</td>
</tr>
<tr>
<td>
<p><strong>Url</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The URL for the article.</p>
</td>
</tr>
<tr>
<td>
<p><strong>ClickUrl</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The URL for linking to the article. See <a href="http://developer.yahoo.com/faq/index.html#clickurl">URL</a> linking for more information.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>NewsSource</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The company that distributed the news article, such as API or BBC.</p>
</td>
</tr>
<tr>
<td>
<p><strong>NewsSourceUrl</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The URL for the news source.</p>
</td>
</tr>
<tr>
<td>
<p><strong>Language</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The language the article is written in.</p>
</td>
</tr>
<tr>
<td>
<p><strong>PublishDate</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The date the article was first published, in <a href="http://en.wikipedia.org/wiki/Unix_time">unix timestamp</a> format.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>ModificationDate</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The date the article was last modified, in <a href="http://en.wikipedia.org/wiki/Unix_time">unix timestamp</a> format.
</p>
</td>
</tr>
<tr>
<td>
<p><strong>Thumbnail</strong></p>
</td>
<td>
<p><em></em></p>
</td>
<td>
<p>The URL of a thumbnail file associated with the article, if present, and its height and width in pixels.</p>
</td>
</tr>
</table>
</div>
<h2 id="faults">Faults</h2>
<h3 id="yaError">400 - application/xml</h3>
<p>See the <a href="http://developer.yahoo.com/search/errors.html">Standard Error documentation</a>.
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment