mardi 29 septembre 2015

REST API merging data from other REST API

I'm developing a REST API using asp.net MVC. I'm using an application database that contains some movie data. In the table movie there is column with a key that is an id that can be used when calling another REST API to get additional information about the movie. This extra information shouldn't be saved in the application database.

I want to implement a GET movie/id (not same id as the external REST API) for my API. When calling this I want to get the movie information from my database but also merge the movie information from the other REST API.

I need advice on design, which is the proper way to do this? My plan was to use repository pattern to access the data from my database. But where should I request the external information and merge it to my model that is sent to the client? Should this be in the controller, the model, the repository that fetches data from the database? Also should i just use System.Net.WebClient to get the external information?

Thanks

Aucun commentaire:

Enregistrer un commentaire