With such a major release, I'd thought that adding JSON support would be a no-brainer; both for input and output format.

So, how to make direct AJAX calls to OpenCalais from a web client app (aka: JavaScript) with this release?


Comments

Hello,
Looking forward to trying it. Thanks for listening.
Rinaldo

Just tested the JSON output. It works fine, but still have two issues / questions:

[1] Why is the output flat?
[2] Why not make the request in JSON as well

[ad 1] Before you can use the output, you have to parse it and create the hierarchy and relationships. Why not provide this straight away?

[ad 2] There's still some XML involved in the paramsXML request parameters. Why not provide these in JSON format as well, so the entire request/response is in JSON.

Hi,

Did you try our Javascript at the bottom of the page http://prerelease.opencalais.com/json ?
It helps you get hirarchy.
As for request in JSON format. We will discuss this internally and update on that.
Thanks,
Ofer

And by the way, give the JSON output a "lite" parameter option, so the response only shows the actual meta data (like the simple format) and not all the analysis bloat. Again to make processing simpler and quicker.

Yep, I've seen the JS helper functions. But why should an OC client after each request build the hierarchy and relationships himself? In other words; why is the response flat? To use the JSON response immediately, flat makes no sense.

Technically theres no requirement to use JSON with Ajax. You can make an Ajax call to the REST interface and handle the response as XML in your JavaScript application (or even the simplified output format).

Calling calais from JavaScript directly is a bad idea for the majority of people anyways. First of all, there the "same origin policy" which you need to work around using hacks. Also you have no control on the number of concurrent requests (theres a limit) and need to expose your API key in the code. Sticking to a solution like calais pipes (http://opencalais.com/CalaisPipes) would be a safer bet.

Hello,

While I understand your view point, I think you should let users decide. Major pioneers in web services like Amazon and Google offer JSON in and JSON out with API keys. We seem to be confusing session authentication and security with ease of use. I don't want to debate it but as a user I would prefer JSON and most web developers I know would eel the same way. If there was another service similar to Calais and it had JSON I would move all my work there.

Rinaldo

In RIA/SOA web apps (aka: todays web development trend) there's a movement in stopping generating HTML from the server; just move plain data between the server and client. And JSON is the protocol here. Plus, by minimizing server contact, the architecture boosts in responsiveness and scalability.

Generating and parsing XML on the browser client is not a trivial / common task. So instead of having the XML to JSON conversion take place on the OpenCalais consumer side, why not deal with it from the OpenCalais service directly.

If this would be the case, the consumer side only requires a simple proxy to the OpenCalais service. It's all a matter of ease of use and speed.