rest - Why my Bing Search API News returns empty string? -
rest - Why my Bing Search API News returns empty string? -
i'm subscribed free bing search api on windows azure website. want add together panel website uses purely client-side code (javascript) query bing search api news results, want sorted relevance.
in order work found interesting article talks how store authentication info in yql (yahoo query language) , utilize proxy query bing search api at: http://derek.io/blog/2010/how-to-secure-oauth-in-javascript/
so, here did:
1) develop yql open info table contains bing key , query parameter. here xml code:
<?xml version="1.0" encoding="utf-8" ?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <samplequery> select * {table} query="washington" </samplequery> </meta> <bindings> <!-- searchresponse.news.relatedsearches.newsrelatedsearch --> <select produces="json"> <urls><url>https://a889dc2f-d0d4-4d16-9f4e-401c750deb04:ifu5p1aw5hafjsmgooxsyaaqyah+m5asvkeq3gg9xiu@api.datamarket.azure.com/bing/search/v1/composite?sources=%27news%27</url></urls> <inputs> <key id="query" default="'new york bonds'+newscategory='rt_business'" paramtype="query" /> </inputs> </select> </bindings> </table>
see set consumerid
, accountkey
? it's @ origin of url (separated colon).
2) save info table in yql's hosted storage. execute, select, , update storage addresses. allows me hide auth information, while eliminating need server-side proxy.
3) utilize execute storage key given by: store://6svu1wupgfrgfcov1bh81u create yql query from, say, yql console. let's utilize next query:
use "store://6svu1wupgfrgfcov1bh81u" t; select * t query="'texas bonds'&newscategory='rt_business'";
uh oh... nail first error. yql console eats , spits out "invalid json document." okay, think console doesn't know how parse query.
fine, let's utilize rest url perform query. url is:
https://query.yahooapis.com/v1/public/yql?q=use%20%22store%3a%2f%2f6svu1wupgfrgfcov1bh81u%22%20as%20t%3b%20select%20*%20from%20t%20where%20query%3d%22%27texas%20bonds%27%26newscategory%3d%27rt_business%27%22%3b&format=json&diagnostics=true
great! interesting happening here. diagnostics in resulting json string say:
"failed read storage... not valid storage address."
i care less, long json string don't care. here problem occurs. seek using resulting rest url this query:
use "store://6svu1wupgfrgfcov1bh81u" t; select * t query="'texas bonds'&newscategory='rt_business'&newssortby='relevance'";
the result empty string (with same storage url error).
why?! exact same query, sorts news results relevance instead of date.
does know heck going on here?
thanks in advance time, much appreciated.
p.s. i've tried putting in other key id's create xml code improve looking screw query. please allow me know if can working love forever.
do think might have done using oauth?
api rest search yql bing
Comments
Post a Comment