mr.olafsson
mr.olafsson

Reputation: 108

YQL request not working when using URL

Can anyone tell me what's wrong with this YQL request:

http://query.yahooapis.com/v1/public/yql?&format=json&q=select%20*%20from%20html%20where%20url=%22http%3A%2F%2Fsearch-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east-1.cloudsearch.amazonaws.com%2F2011-02-01%2Fsearch%3Ffacet%3Dgenre%26return-fields%3Dactor%2Cdirector%2Ctitle%2Cyear%2Ctext_relevance%26q%3DLove%26bq%3D%28and%20%28field%20genre%20'Romance'%29%29%22%20and%20xpath=%22*%22

When I submit the URL it complains about directly it works fine. I believe I'm escaping all the reserved characters appropriately :(

Thanks in advance!

Upvotes: 0

Views: 2087

Answers (1)

Karan Ashar
Karan Ashar

Reputation: 1400

You need to url encode the white space in the bq parameter before issuing the YQL request. The YQL select statement would be:

select * from html where url="http://search-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?facet=genre&return-fields=actor,director,title,year,text_relevance&q=Love&bq=(and%20(field%20genre%20'Romance'))" and xpath="*"

Notice the encoding of white spacing in the bq URL parameter. The YQL request would be:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fsearch-movies-jc4u2tqsvf5jgd7xxmceezlu24.us-east-1.cloudsearch.amazonaws.com%2F2011-02-01%2Fsearch%3Ffacet%3Dgenre%26return-fields%3Dactor%2Cdirector%2Ctitle%2Cyear%2Ctext_relevance%26q%3DLove%26bq%3D(and%2520(field%2520genre%2520'Romance'))%22%20and%20xpath%3D%22*%22&diagnostics=true

Upvotes: 2

Related Questions