Permalink
Browse files

fixed mappings for Guardian API

  • Loading branch information...
1 parent 9f20c1a commit 8565f4d988dce1473861f480591ebfa146669525 @spier spier committed Nov 14, 2010
View
3 guardian/env.txt
@@ -1,3 +0,0 @@
-use 'http://github.com/spullara/yql-tables/raw/2c063bd7e1377e00f608eeed425a9f207fa400af/guardian/guardian.content.item.xml';
-use 'http://github.com/spullara/yql-tables/raw/2c063bd7e1377e00f608eeed425a9f207fa400af/guardian/guardian.content.search.xml';
-use 'http://github.com/spullara/yql-tables/raw/2c063bd7e1377e00f608eeed425a9f207fa400af/guardian/guardian.content.tags.xml';
View
43 guardian/guardian.content.item.xml
@@ -1,19 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
- <meta>
- <author>Josh Gordineer</author>
- <description>Guardian Item API</description>
- <sampleQuery>select * from {table} where item_id='334767774'</sampleQuery>
- </meta>
- <bindings>
- <select itemPath="content" produces="XML">
- <urls>
- <url>http://api.guardianapis.com/content/item/{item_id}</url>
- </urls>
- <inputs>
- <key id="item_id" type="xs:string" paramType="path" required="true" />
- <key id="api_key" type="xs:string" paramType="query" required="true" />
- </inputs>
- </select>
- </bindings>
-</table>
+ <meta>
+ <author>Sebastian Spier</author>
+ <description>Guardian Item API (remember to get an API key for full functionality http://guardian.mashery.com/)</description>
+ <documentationURL>http://www.guardian.co.uk/open-platform/content-api-item-reference-guide</documentationURL>
+ <sampleQuery>SELECT * FROM {table} WHERE item_id='sport/2010/oct/21/jenson-button-mark-webber-korea-f1'</sampleQuery>
+ </meta>
+ <bindings>
+ <select itemPath="response.content" produces="XML">
+ <urls>
+ <url>http://content.guardianapis.com/</url>
+ </urls>
+ <inputs>
+ <key id="api_key" type="xs:string" paramType="query" required="false" />
+ <key id="format" type="xs:string" paramType="query" default="xml" const="true" />
+ <key id="item_id" type="xs:string" paramType="variable" required="true"/>
+ <key id="show-fields" type="xs:string" paramType="query" default="all" />
+ <key id="order-by" type="xs:string" paramType="query" default="newest" />
+ </inputs>
+ <execute><![CDATA[
+ // the key 'item_id' needs to be added to the URL in the execute block because otherwise the / gets encoded in the URL and the API call fails
+ // see for details: http://stackoverflow.com/questions/4067374/preventing-yql-from-url-encoding-a-key
+ response.object = request.path(item_id).get().response;
+ ]]></execute>
+ </select>
+ </bindings>
+ </table>
View
56 guardian/guardian.content.search.xml
@@ -1,28 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
- <meta>
- <author>Josh Gordineer</author>
- <description>Guardian Content Search API</description>
- <sampleQuery>select * from {table} where q='environment'</sampleQuery>
- </meta>
- <bindings>
- <select itemPath="search.results.content" produces="XML">
- <urls>
- <url>http://api.guardianapis.com/content/search</url>
- </urls>
- <paging model="offset">
- <start id="start-index" default="0" />
- <pagesize id="count" max="500" />
- <total default="10" />
- </paging>
- <inputs>
- <key id="q" type="xs:string" paramType="query" />
- <key id="after" type="xs:string" paramType="query" />
- <key id="before" type="xs:string" paramType="query" />
- <key id="content-type" type="xs:string" paramType="query" />
- <key id="filter" type="xs:string" paramType="query" />
- <key id="api_key" type="xs:string" paramType="query" required="true" />
- </inputs>
- </select>
- </bindings>
+ <meta>
+ <author>Sebastian Spier</author>
+ <description>Guardian Content Search API (remember to get an API key for full functionality http://guardian.mashery.com/)</description>
+ <documentationURL>http://www.guardian.co.uk/open-platform/content-api-content-search-reference-guide</documentationURL>
+ <sampleQuery>SELECT * FROM {table} WHERE q='Hungary'</sampleQuery>
+ </meta>
+ <bindings>
+ <select itemPath="response.results.content" produces="XML">
+ <urls>
+ <url>http://content.guardianapis.com/search</url>
+ </urls>
+ <paging model="offset">
+ <start id="page" default="1" />
+ <pagesize id="page-size" max="50" />
+ <total default="10" />
+ </paging>
+ <inputs>
+ <key id="api_key" type="xs:string" paramType="query" required="false" />
+ <key id="format" type="xs:string" paramType="query" default="xml" const="true" />
+ <key id="q" type="xs:string" paramType="query" />
+ <key id="from-date" type="xs:string" paramType="query" />
+ <key id="to-date" type="xs:string" paramType="query" />
+ <key id="tag" type="xs:string" paramType="query" />
+ <key id="section" type="xs:string" paramType="query" />
+ <key id="show-tags" type="xs:string" paramType="query" />
+ <key id="show-fields" type="xs:string" paramType="query" />
+ <key id="show-refinements" type="xs:string" paramType="query" />
+ <key id="order-by" type="xs:string" paramType="query" default="newest" />
+ </inputs>
+ </select>
+ </bindings>
</table>
View
26 guardian/guardian.content.sections.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
+ <meta>
+ <author>Sebastian Spier</author>
+ <description>Guardian Sections API (remember to get an API key for full functionality http://guardian.mashery.com/)</description>
+ <documentationURL>http://www.guardian.co.uk/open-platform/content-api-content-search-reference-guide</documentationURL>
+ <sampleQuery>SELECT * FROM {table}</sampleQuery>
+ </meta>
+ <bindings>
+ <select itemPath="response.results.section" produces="XML">
+ <urls>
+ <url>http://content.guardianapis.com/sections</url>
+ </urls>
+ <paging model="offset">
+ <start id="page" default="1" />
+ <pagesize id="page-size" max="50" />
+ <total default="10" />
+ </paging>
+ <inputs>
+ <key id="api_key" type="xs:string" paramType="query" required="false" />
+ <key id="format" type="xs:string" paramType="query" default="xml" const="true" />
+ <key id="q" type="xs:string" paramType="query" />
+ </inputs>
+ </select>
+ </bindings>
+</table>
View
46 guardian/guardian.content.tags.xml
@@ -1,24 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
- <meta>
- <author>Josh Gordineer</author>
- <description>Guardian Tags API</description>
- <sampleQuery>select * from {table} where q='environment'</sampleQuery>
- </meta>
- <bindings>
- <select itemPath="tags.tag" produces="XML">
- <urls>
- <url>http://api.guardianapis.com/content/tags</url>
- </urls>
- <paging model="offset">
- <start id="start-index" default="0" />
- <pagesize id="count" max="500" />
- <total default="10" />
- </paging>
- <inputs>
- <key id="q" type="xs:string" paramType="query" required="true" />
- <key id="api_key" type="xs:string" paramType="query" required="true" />
- </inputs>
- </select>
- </bindings>
+ <meta>
+ <author>Sebastian Spier</author>
+ <description>Guardian Tags API (remember to get an API key for full functionality http://guardian.mashery.com/)</description>
+ <documentationURL>http://www.guardian.co.uk/open-platform/content-api-tag-search-reference-guide</documentationURL>
+ <sampleQuery>SELECT web-title FROM {table}(0,70) WHERE type='keyword'</sampleQuery>
+ <sampleQuery>SELECT * FROM {table} WHERE q='money'</sampleQuery>
+ </meta>
+ <bindings>
+ <select itemPath="response.results.tag" produces="XML">
+ <urls>
+ <url>http://content.guardianapis.com/tags</url>
+ </urls>
+ <paging model="offset">
+ <start id="page" default="1" />
+ <pagesize id="page-size" max="50" />
+ <total default="10" />
+ </paging>
+ <inputs>
+ <key id="api_key" type="xs:string" paramType="query" required="false" />
+ <key id="format" type="xs:string" paramType="query" default="xml" const="true" />
+ <key id="q" type="xs:string" paramType="query" />
+ <key id="type" type="xs:string" paramType="query" />
+ </inputs>
+ </select>
+ </bindings>
</table>

0 comments on commit 8565f4d

Please sign in to comment.