3 ms·
ASk HN: A json - jsonp proxy service
Hi All,
I've run up against the cross-site ajax issue of not being able to request a json from another domain. Sadly this domain does not offer a jsonp alternative.
Of course I can write/host my own proxy, but 1) I was wondering whether there are any proxy services already available (Yahoo yql?) or 2) if not, whether it would be worth setting one up for public use?
Feedback/thoughts appreciated!
- petercooper 16y agoDoes the other domain have a CORS policy? If so: http://ajaxian.com/archives/cor-blimey-cross-domain-ajax-is-really-here http://ajaxian.com/archives/cor-blimey-cross-domain-ajax-is-...
- retube 16y agoNo idea. Thanks for the link, I'll investigate.
- pmjordan 16y agoIt should be noted that as far as I know, CORS only works with FF 3.5+, Safari 4+, Chrome (4+?), IE8+ and current versions of Mobile Safari. You'll still need a JSON(p) proxy for others, but if CORS is supported by the server, it's worth using just for the speed gain & bandwidth savings.
- lenni 16y agoI think Yahoo pipes does what you need: http://pipes.yahoo.com http://pipes.yahoo.com
- retube 16y agook, interesting. I know nothing about pipes, so will look it that. Thanks.
- buro9 16y agoPipes is a wonderful thing, you can do a lot with it (like consume Google Analytics emails with it to be able to make public charts by scraping the analytics XML attachments and surfacing them as public JSON: http://blogoscoped.com/archive/2008-01-17-n73.html http://blogoscoped.com/archive/2008-01-17-n73.html ). The only problem with pipes is that if you're building anything that you will depend on (rather than it being a "nice to have") then your service now wholly depends on Yahoo maintaining pipes. The question I always fall back to is, "Do I want my service to be wholly dependent on a third party if I can avoid it?". As you can avoid it, I'd choose to write my own proxy in this instance.
- charliepark 16y agoCheck out GDATA (from Google) and YQL (from Yahoo). Actually, here's a tutorial that goes into using jQuery and YQL: http://ajaxian.com/archives/using-yql-as-a-proxy-for-cross-domain-ajax http://ajaxian.com/archives/using-yql-as-a-proxy-for-cross-d...
- retube 16y agook great thanks. I'll try and hack it to avoid using jQuery though, not a huge fan of using libs if only utilising a single feature/function
- pierrefar 16y agoI set up exactly this thing yesterday with Yahoo Pipes. But they're having problems these days (apparently since December): lots of connection refused errors and others. Some bloggers "broke up" with the service and others were more blunt.
- retube 16y agodo you pay for this? Are there caps on usage or restrictions on application types you can use it for?
- pierrefar 16y agoAll free. Start here: http://pipes.yahoo.com/pipes/docs?doc=overview http://pipes.yahoo.com/pipes/docs?doc=overview
- retube 16y agoCool, thanks. Just thinking, but is there not a way in javascript to just get the contents of a URI as a string? Which you could then eval? Presumably this will be possible with WebSockets?
- paulirish 16y agohttp://jsonpify.com/ http://jsonpify.com/ is probably ideal for you.... The API is like http://jsonpify.com/api?url=XXX&format=xml&jsonp=mycallback http://jsonpify.com/api?url=XXX&format=xml&jsonp=myc... but you can also do this with http://pipes.yahoo.com/pipes/ http://pipes.yahoo.com/pipes/ and http://developer.yahoo.com/yql/console/ http://developer.yahoo.com/yql/console/ . Both are excellent and used often for this exact purpose.
- retube 16y agoYes looks like exactly what I'm looking for - super simple. I note he also mentions YQL, which might be the way to go for higher-use apps
- donohoe 16y agoI've used YQL via the Console and works a charm unless the site prohibits it in its robots.txt (like Google Image Search) http://developer.yahoo.com/yql/console http://developer.yahoo.com/yql/console