Siddu Siddu - 1 year ago 94
HTTP Question

HTTP GET in a REST based application to transform data on server and return the result

I have a REST based application which is being upgraded from v1 to v2 and migration has to be done lazily.

In v1 I have some data say investigator saved in one bean and bean is persisted in DB.
In v2, I have a GET call

HTTP GET @ /investigators

which lists investigators but from a separate table dedicated to investigators.

During migration I need to make sure the data saved in v1's bean is available as an investigator in v2's GET call.

So the question is, is it advisable to save all the investigatros from v1's bean to DB table and then respond to GET call with the list reading from INVESTIGATORS table?

I know that we'll not be compliant with REST principles here. But can this be considered based on the practical use cases? If not what is the other way of getting around this problem?

Answer Source

From a REST point of view, it does not matter when the backend behind the REST interface will have data available. If your lazy migration forces you to provision the data for a specific investigator and the moment it is requested for the first time, this fine. I can see no violation of REST principles.

Of course the code that implements the GET request should not directly copy data from DB1 to DB2. It should call a service that does this behind the scenes.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download