forked from yql/yql-tables
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added microsoft/translator/microsoft.translator.xml (unfiltered) via …
…YQL Table Editor
- Loading branch information
1 parent
07b6a71
commit 708ab9d
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |