RESTful API endpoints conceptualization as representations in MVC design pattern

As I try to describe the system that I created in a research article, I encountered the following problem for designation when I try to imagine the complexity of the system I created:

  • Suppose I am an A service engineer, communicating with the world exclusively through its RESTful endpoints. Then I create service B, which uses service A as its backbone and presents its data to the outside world.
  • Suppose service A has its own models and data controllers. Should RESTful endpoints be conceptualized as representations in an MVC pattern?
  • Suppose service B has its own set of proxy models that display the more or less immediate service models of A. It provides users with many graphical interfaces with a completely separate set of controllers. Where is service A included in MVC? Should it be presented as an encapsulated model?

Real world example (not related to the problem I'm working on):

  • del.icio.us and pinboard.in provide approximately the same set of APIs and thus can be replaced as service A for service clients (for the purpose of the question, it is assumed that they are both built on the MVC pattern, but can have completely different sets of models and controllers)
  • Delibar is an iOS application and therefore follows the MVC pattern and meets the requirements for service B; Suppose that Delibar models its data after the service A data models presented at the API endpoints.

So pinboard.in and del.icio.us are the model for Delibar? Are RESTful points of view? And thus representations represent the same for pinboard.in and del.icio.us?

+4
source share
1 answer

Endpoints are actions / operations on the controller. Views are data (HTML, XML, JSON or otherwise) returned by the controller in response to an HTTP GET request.

Service A is not represented as part of the MVC triad of Service B, since MVC deals with interacting with the model and choosing the Views controller. Service A is accessed through the data access level of service B. If you use the Active Record template, requests or changes to the Model by the controller in Service B will be transferred to the data access level by the model itself. If you use the Domain Service / Data Mapper template / Repository, the controller is invoked at this level, which encapsulates data access.

+1
source

All Articles