I have a JSON feed (which I don’t directly control, I have to ask the server admins to update it), that is returning NULL, or otherwise not working when I try to access it from another server. The actual feed works fine, but I can’t get it to work like a normal API.
Why can I use Flickr, WhitePages, Twitter, etc’s JSON APIs, but for:
http://portlandoregon.gov/shared/cfm/json.cfm
It returns NULL in the browser when using JS. If I call it on the same server, it’s fine though.
If this is a server issue, what do I ask the admins to change, and if this is a local (browser) based issue, what am I doing wrong for this one feed that works for every other JSON API?
They have set the content type to
text/htmlinstead ofapplication/json. So if you’re using jQuery$.ajaxor$.getinstead of$.getJSON, then you need to instruct it to handle it asapplication/jsonso that it will automatically parse it as JSON.On the other hand, if really no data is been returned, then they are maybe checking who/what is requesting it and blocking it. The only resort is indeed to contact them. It might be a bug, or it might be awarely builtin to prevent leeching.