I am new to REST API currently i am working on a project where I have 2 resources:
- Project
- Client
Now for this did I need to create 2 resource class as given below or a single resource class.
@Path("/v1/projects") public interface ProjectResource { @POST public Respone add(Project project) @DELETE public Respone delete(Project project) @PUT public Respone update(Project project) } @Path("/v1/projects/{projectId}/client") public interface ClientResource { @POST public Respone add(Client client) @DELETE public Respone delete(Client client) @PUT public Respone update(Client client) } Or a single resource class with all methods
@Path("/v1/projects") public interface ProjectResource { @POST public Respone add(Project project) @DELETE public Respone delete(Project project) @PUT public Respone update(Project project) @Path("/{projectId}/client") @POST public Respone add(Client client) @Path("/{projectId}/client") @DELETE public Respone delete(Client client) @Path("/{projectId}/client") @PUT public Respone update(Client client) }