Hi!
This has been following me for a long time and seems like it is last minute to do this. Sylius currently provide RESTful API for the most important entities and operations, like checkout & cart. That being said, they are done as AdminUser, not the Customer. So it is an Admin API.
I plan to introduce a ShopAPI that will provide a different type of API, suitable for SPAs & mobile devices, etc. I am not sure if it will be in core (1.1) or a separate Plugin. That being said, I want to avoid confusion in a situation where we introduce ShopApiBundle and we end up with ApiBundle.
Options:
BC Breaks:
There was no strong BC promise on the API, so I believe we can still do this. Let me know what do you think!
I vote for AdminApiBundle
If we want to indicate the separateness of Admin* and Shop* APIs concepts, then AdminApiBundle is the best choice 馃憤
AdminApiBundle + 1
@pjedrzejewski,
Sorry if this has been asked and answered elsewhere. But rather than having a separate bundle specifically for a ShopApi, why doesn't the standard API take on that responsibility. The way spree handles this I think is pretty elegant in that, there's a definition of CRUD operations that can occur per Entity by a user with a set of roles within the system.
If the authentication mechanism was abstract so that you could plug and play a method of authentication (e.g. Oauth, WSSE, or JWT via something like the LexikJWTAuthBundle), then the available API operations would resolve to the users permissions within the system. In that case then certain things could be limited like the ability to specify a customer on an order when placed, or the ability to CRUD config etc.
Perhaps this is a dumb idea, and I'm open to that as I don't have a super indepth knowledge of Sylius (yet), but I just thought I'd throw it out there.
Great project!
@jspizziri Thanks for your comment! :)
We decided to go with a separate bundle because the API for shop operations is a bit more than just differences in permissions. Example:
Admin REST API is very crudish, and it also includes more data than you usually need in the frontend. Frontend developers (from our experience) are most happy when they get JSON with all information that they just need to put in the right place of the template without worrying about: recalculations, translations, currency formatting, etc. The Admin REST API is more suitable for integrations, where you have access to full data (like all translations at once of the product) and Shop API is for mobile/progressive apps development, where you just want to get a product in specific channel & locale and not worry about anything. Compare these:
Thanks for the explanation!
Most helpful comment
I vote for
AdminApiBundle