[Flow] Feedback/call for contribution on a generic Rest API package
Søren Malling
soren.malling at gmail.com
Thu Dec 5 12:45:41 CET 2013
Hi guys,
Don't wan't to read, go check the bottom for links
Yesterday I tweeted about a generic Rest API package [1] that I could
really use some feedback on.
The API package is being built as a part of a project with 5 friends, where
we in the long run, will serve our data through a Api for customers, mobile
devices/apps etc.
First the package was really "hardcoded" for our own purpose, but after
finetuning some of the code this concept came up.
HERE COMES THE IMPORTANT PART
The project is available here [2] from my own gitlab installation (sorry,
not public github atm due to some restrictions on a font we bought - really
shitty..)
http://git.meteko.dk/scoutrace/api/
It still has some not-used files from the first version, so I will describe
the important parts here
Parts here are not implemented, but I will hope to call for a community
effort to have a awesome Rest API package!
The endpoints of the Api is configurated in Settings.yaml[3]
http://git.meteko.dk/scoutrace/api/blob/master/Configuration/Settings.yaml
Here you can set allowedRequestParameters (for filtering, sorting, search
query etc - not yet implemented), allowed methods to this specific endpoint
(instead of Routes.yaml configuration - not yet implemented)
By defining you objectType for the endpoint, all properties can
automatically be calculated by the corresponding getter/setter functions of
the model and the related models.
This whole thing is handled by the ApiController[4] which get's a endpoint
from the Routes.yaml configuration and takes the rest from the Settings
http://git.meteko.dk/scoutrace/api/blob/master/Classes/Scoutrace/Api/Controller/ApiController.php
Rendering is done with a custom JsonView [5] taking care of the properties
set for display. It is very different from the JsonView known from
TYPO3.Flow.
One of the goals is to make it possible to have the configuration
overwritten by other packages, thats the reason for the many "options"
possibilities - and that is already possible with the Settings.yaml concept.
I would love to hear your feedback and perhaps some people will help out
and we can reach a awesome goal that we can all benefit from (hallelulja!)
All the best!
Søren
[1] https://twitter.com/sorenmalling/status/408136608656150528
[2] http://git.meteko.dk/scoutrace/api/
[3]
http://git.meteko.dk/scoutrace/api/blob/master/Configuration/Settings.yaml
[4]
http://git.meteko.dk/scoutrace/api/blob/master/Classes/Scoutrace/Api/Controller/ApiController.php
[5]
http://git.meteko.dk/scoutrace/api/blob/master/Classes/Scoutrace/Api/View/JsonView.php
More information about the Flow
mailing list