0

According to the REST protocol, is it correct to do any write operation from the controller handling a GET call.

For example, I have a GET API that gets me some data, but in order to get that data, I have to call a separate third-party service. What I want is to cache/ store this data in my database so that next time I do not have to call the third-party API. But in order to store the entry in my database I will have to do a write operation, the question is, is it technically correct according to the REST API protocol.

Any other alternatives to implement the same flow are most welcome

  • 1
    If the API *behaves outwardly* as only retrieving data without significantly altering the "state" of data in the server, reading from somewhere and writing caches are internal implementation details. Even the most trivial GET requests will at least *write log file entries*; that doesn't count against the "GET" nature at all. – deceze Mar 17 '22 at 09:08

0 Answers0