Skip to main content
Topic: JSON API (Read 777 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

JSON API

Looking through Elk's source, it seems we have quite a mess of different ways to interact with the backend, including the xmlhttp action, which calls Xml.controller.php along with a handful of JSON sub-actions scattered around the place.

Can we make a 1.1/2.0 goal to have a standardised JSON API? Such that if we implement a proper router, calls specifying JSON, will have JSON values returned and those not specifying will be returned through the templates as usual.

Then we can use JSON as a means of both AJAX calls on templates and also stuff like native mobile apps.

Re: JSON API

Reply #1
I'd love to see this as well!

At one point all ajax was done through that xmlhttp request, including the callbacks.  As more jquery found its way in, and we did not have json limitations of older php versions, newer calls went the $.ajax route with a mixture of json or xml

Anyway all of that really needs to be standardized and rationalized a bit, I don't see why it can't be started (or even completed) on 1.1, just needs someone to come up with some implementation ideas.
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.

 

Re: JSON API

Reply #2
Yup!
That would be really awesome!

There is already a kind of start on the standardization: in theory, all the calls with an "api" parameter in the url should return either an xml or a json request (the api parameter can accept also a "json" or "xml" value (api=json or api=xml) to define what to return).
So, if the controller knows how to deal with this "api" parameter it can return the proper data.

That said, even that is not really *very* well standardized. LOL

Feel free to play with any solution you think it's best!
Bugs creator.
Features destroyer.
Template killer.