Preventing YQL from URL encoding of key

Hans Müller29 Oct 2010 1:51 PM
I am wondering if it is possible to prevent YQL from URL encoding a key for a datatable?

Example: The updated guardian API works wit IDs like this:
item_id = "environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy"

So If I now have this query
CODEBOX
SELECT * FROM guardian.content.item WHERE item_id='environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy'


while using the following key defintion in my datatable
CODEBOX
<url>http://content.guardianapis.com/{item_id}</url>


then this results in this API call (see the URL encoding if item_id)
CODEBOX
http://content.guardianapis.com/environment%2F2010%2Foct%2F29%2Fbiodiversity-talks-ministers-nagoya-strategy?format=xml&order-by=newest&show-fields=all


Instead the guardian API expects the call to look like this:
CODEBOX
http://content.guardianapis.com/environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy?format=xml&order-by=newest&show-fields=all


How can I achieve this? You can also check the full datatable:
http://github.com/spier/yql-tables/blob/ma...ontent.item.xml
Stephen8 Feb 2012 6:34 PM
Hey Hans,&nbsp;<br><br>I see you fixed this issue by using the execute block in your table.<br><br>response.object = request.path(item_id).get().response;<br><br>The other way to do this w/o using &#39;execute&#39; is to simply change the key to paramType=&quot;path&quot; which will insert it correctly into the path of the url.<br><br>&lt;key id=&quot;item_id&quot; type=&quot;xs:string&quot; paramType=&quot;variable&quot; required=&quot;true&quot;/&gt;&nbsp;<br><br>Also - you would need to change your &lt;url&gt; node back to the way you had it:<br><br>&lt;url&gt;http://content.guardianapis.com/{item_id}&lt;/url&gt;<br><br>Hope that helps in the future.<br><br>stephen
spier10 Feb 2012 3:41 AM
Does this mean that the way that the parameters are URL encoded has been changed?<br>I have used paramType=&quot;path&quot; in my inital test above, and it did not work, as the slashes in the parameter would get URL encoded.