Permalink
Browse files

Merge pull request #208 from yql/708ab9df0d40291fdb6d3f3d3d5a71238c73…

…f3bd

Added microsoft/translator/microsoft.translator.xml (unfiltered) via YQL Table Editor
  • Loading branch information...
pjdonnelly committed Aug 20, 2012
2 parents 07b6a71 + 708ab9d commit ac076dff75f71d2e9c3bc59ef1ee474e67702b4f
Showing with 36 additions and 0 deletions.
  1. +36 −0 microsoft/translator/microsoft.translator.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
+ <meta>
+ <author>Paul Donnelly (@pjdonnelly)</author>
+ <description>Get your Bing translate keys here: https://datamarket.azure.com/developer/applications/</description>
+ <documentationURL>http://msdn.microsoft.com/en-us/library/ff512421</documentationURL>
+ <sampleQuery>select * from {table} where text="hello world" and client_id="" and client_secret=""</sampleQuery>
+ </meta>
+ <bindings>
+ <select itemPath="" produces="XML">
+ <urls>
+ <url></url>
+ </urls>
+ <inputs>
+ <key id="text" type="xs:string" paramType="query" required="true" />
+ <key id="from" type="xs:string" paramType="query" default="en" />
+ <key id="to" type="xs:string" paramType="query" default="es" />
+
+ <key id="client_id" type="xs:string" paramType="query" required="true" />
+ <key id="client_secret" type="xs:string" paramType="query" required="true" />
+ <key id="scope" type="xs:string" paramType="query" default="http://api.microsofttranslator.com" />
+ <key id="grant_type" type="xs:string" paramType="query" default="client_credentials" />
+ </inputs>
+ <execute>
+ <![CDATA[
+ var params = "client_id=" client_id "&client_secret=" client_secret "&scope=" scope "&grant_type=" grant_type;
+
+ var resp = y.rest("https://datamarket.accesscontrol.windows.net/v2/OAuth2-13/").accept(\\\\\\\'application/json\\\\\\\').contentType("application/x-www-form-urlencoded").post(params).response;
+ var MSTranslate = y.rest("http://api.microsofttranslator.com/v2/Http.svc/Translate?text=" text "&from=" from "&to=" to).header("Authorization","Bearer " resp.access_token).get().response;
+
+ response.object = MSTranslate;
+ ]]>
+ </execute>
+ </select>
+ </bindings>
+</table>

0 comments on commit ac076df

Please sign in to comment.