REST API - GET method with input parameter as a JAVA object in the body

What is my current REST GET method.

@GET
@Path("/URI/{input1}")
@Produces(MediaType.APPLICATION_JSON)
public List<T> getDetails(@PathParam("input1") String input1) throws ServiceException;

Now I want to add 3 more input parameters. Instead of adding all 4 parameters as pathparams, can I create a POJO object with all 4 input parameters and pass this POJO method to GET like this

@GET
@Path("/URI")
@Produces(MediaType.APPLICATION_JSON)
public List<T> getDetails(InputPojo input) throws ServiceException;

POJO class with input parameters:

class InputPojo {
    String input1;
    String input2;
    String input3;
    // Getters and Setters.
}

Or is it against the REST GET specification and I cannot use a Java POJO object as an input parameter?

+4
source share
1 answer

HTTP GET . . URI.

GET. (, JSON), base64 ( , , URI), input1 (, /URI/encodedpojohere). input1 Java POJO.

( URI - 65535 ). ( ). , POJO GET -// . POST PUT. Spring, / .

+3

Source: https://habr.com/ru/post/1684133/


All Articles