Extending the API
Permalink Browser Info Environment
Hi 5Jack!
I love what you've done here, this will really be great and useful in some projects.
One point though is the extendibility of the API. I would love if you could extend the API in a way that you can currently extend the Events in concrete5. Now if I want to add new API methods, I'll need to modify the API controller to do that.
So, just one idea that you could define the API methods something like this:
So, something similar that you currently do with events? The only difference might be that one API action can have only ONE function that provides the information.
Then in the api/controller.php you could check whether the called action has any API method, something like this:
What do you think?
Best,
Antti / Mainio
I love what you've done here, this will really be great and useful in some projects.
One point though is the extendibility of the API. I would love if you could extend the API in a way that you can currently extend the Events in concrete5. Now if I want to add new API methods, I'll need to modify the API controller to do that.
So, just one idea that you could define the API methods something like this:
JacksAPI::setApi('page', 'MyOwnApiController', 'page_api', __FILE__);
So, something similar that you currently do with events? The only difference might be that one API action can have only ONE function that provides the information.
Then in the api/controller.php you could check whether the called action has any API method, something like this:
$array = JacksAPI::launch($_GET['action']); if ($array) { $this->set('array',$json->encode($array)); } else { $e = JacksAPI::getErrors(); }
What do you think?
Best,
Antti / Mainio
Type: | Discussion |
---|---|
Status: | New |
this seems like a really good idea. I'll take a stab at implementing it, but it might take a while.
Ok, great to hear!
Yeah, I'm not saying I would need it NOW but I know I will need a feature as such in the future.
Another point that you might want to keep in mind is that people also might want to "override" the current API actions, so that should also be considered when building an architecture like that.
Antti
Yeah, I'm not saying I would need it NOW but I know I will need a feature as such in the future.
Another point that you might want to keep in mind is that people also might want to "override" the current API actions, so that should also be considered when building an architecture like that.
Antti