I’m wondering if there is a way to send headers from YQL (or the YQL console) like there is in cURL.
I would like to return JSON by specifying the header Accept: application/json.
I am able to return JSON in with cURL and the command line like this:
curl -H 'Accept: application/json' http://www.opendatabc.ca/data?=births
but I can’t figure out how to set the header when sending YQL.
You can do this with YQL Open Data Tables.
Here is a simple demonstration.
You can find the gist for the example Open Data Table XML file here: https://gist.github.com/2042904 (Check out the documentation here.)
You will notice in my example XML that I’m using y.xmlToJson on the response object received from the get() request. This is because YQL converts JSON taken from web services into E4X. More about that in a question of mine.