First of all have a nice weekend for those who are! For the other good luck :)
I am creating an app using rest architecture.
I just have a simple question but I don't know how to explain it.
So let's take an example and maybe the question will come after.
Imagine you have a path element called Car. If I do a GET on it it returns the carInformation
So I would define:
@GET
@Path("/car/{carid}/display")
public Response getCar(@PathParam("carid")String carID)
If I define actions to perform on this car like open, close, start etc:
@POST
@Path("/car/{carid}/startup")
public Response startup(@PathParam("carid")String carID)
@POST
@Path("/car/{carid}/open")
public Response open(@PathParam("carid")String carID)
@POST
@Path("/car/{carid}/close")
public Response close(@PathParam("carid")String carID)
Is there a common check done at /car/{carid} like "is it my car?" "is it in the garage?" or do I have to implement it with abstraction for example between the process which will be called after
In fact I am not understanding the real goal of path param. Why don't do simply
@GET
@Path("/car/displayCar")
public Response getCar(@QueryParam("carid")String carID)
@POST
@Path("/car/startup")
public Response startup(String carID)
@POST
@Path("/car/{carid}/open")
public Response open(String carID)
@POST
@Path("/car/{carid}/close")
public Response close(String carID)
Thanks all for you answer in advance
Best regards
Geoffrey MUSELLI