[英]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. 我有一个基于REST的应用程序,该应用程序已从v1升级到v2,迁移工作很懒惰。
In v1 I have some data say investigator saved in one bean and bean is persisted in DB. 在v1中,我有一些数据说调查者保存在一个bean中,并且bean保留在DB中。 In v2, I have a GET call
在v2中,我有一个GET呼叫
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. 在迁移期间,我需要确保保存在v1的bean中的数据可以作为v2的GET调用中的调查者使用。
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? 因此,问题是,是否建议将所有调查对象从v1的bean保存到DB表,然后使用从INVESTIGATORS表中读取的列表来响应GET调用?
I know that we'll not be compliant with REST principles here. 我知道我们在这里不符合REST原则。 But can this be considered based on the practical use cases?
但是,可以根据实际用例来考虑吗? If not what is the other way of getting around this problem?
如果不是,解决该问题的另一种方法是什么?
From a REST point of view, it does not matter when the backend behind the REST interface will have data available. 从REST的角度来看,REST接口后面的后端何时有可用数据并不重要。 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.
我看不到任何违反REST原则的情况。
Of course the code that implements the GET request should not directly copy data from DB1 to DB2. 当然,实现GET请求的代码不应直接将数据从DB1复制到DB2。 It should call a service that does this behind the scenes.
它应该调用在后台执行此操作的服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.