REST API and HTTP Methods

by user1050166   Last Updated December 14, 2017 20:05 PM

Sorry for the basic question, but I'm still trying to wrap my head around RESTful interfaces in certain situations.

I am new to REST services, and we are using Spring Data REST. My team lead is really big on doing things "the RESTful way" because "it's the industry standard." I understand this to a point, but am having some issues with the specifics.

We have several Docker micro-services, each with their own DB and Spring Data REST interfaces. We were having some problems using RestTemplate to add an object to a list within another object. I was able to convince him to let me create my own service to do it within the container that has direct access to the DB. This is done using a CrudRepository. This made a lot more sense to me because the service gets objects A and B if they exist, or creates them if they don't, and then adds object B to the list if it's not already in there.

So he then says that we still need to be doing things "the RESTful way" and using the correct HTTP methods (i.e. POST to create a new object, PUT/PATCH to update an existing object). My issue with this is that the code that's calling the service doesn't know if it already exists in the DB, and it doesn't make sense to me to do multiple service calls to accomplish something that should be encapsulated within the service that contains the DB.

My question is: am I looking at this the wrong way? It seems like we're bending over backwards to conform the a RESTful architecture pattern when it doesn't really seem to make sense.

Thanks in advance for any insight/advice.



Related Questions



Implementing a REST API in a Clean Architecture

Updated July 01, 2018 09:05 AM

Project structure for Spring Boot App

Updated December 04, 2017 14:05 PM


Spring Boot test data population

Updated February 15, 2018 14:05 PM