Road map for OFN's API?

Hi Rob, interesting!

— Do we need a road map?

I think we first need to define what APIs do we need (public/internal, spree/ofn, etc) and how to build them (tech decisions). Then, the growth of the API should not a task in itself but be a part of normal development of other features.

— we extend Spree’s existing API, or do we start fresh?

Is it not simple to “start fresh” with our API but using adapters/redirects to the spree API?

— Should we be separating out all of our JSON/AJAX focussed API actions and logic into separate controller hierarchy?

I think this is a must. We cannot have app/views logic mixed with API logic…
I think you are saying that, for example, controllers/ShopController should be in controllers/api?
I wonder why is stuff in views/api not in controllers/api. Can we set a rule that every view or controller that is rendering JSON goes into controller/api?
Also, I am not sure how app/serializers/api are used. Are these only used in AMS injection or are they part of some API?

— Do we drop the idea of “internal use only” and instead re-build everything in a single coherent API that works for both? If so, how do we manage authentication while keeping the API nice and DRY?

I think we should drop the notion of “internal use only”.

Next Steps…
I think we first need a map of what’s currently in there, can we go into more detail about the 3 APIs you list above?

  • Can you point to the code where those 3 APIs are implemented?
  • Can you map them into these folders with RABL files in the OFN code base?
    • ./app/views/api
    • ./app/views/open_food_network
    • ./app/views/json
    • ./app/views/admin/json
    • ./app/views/spree/api (spree API overrides)
  • Can you understand and explain each of these folders and what are the good/new ones and what are the old/bad ones?
  • From what I understand there are these 5 places with rabl files plus all the controllers that also take and produce json, plus AMS injectors…

If someone can guide me in this initial understanding (answering my questions above), I can then create that map. Thanks!